How to install Apache, MariaDB and PHP on CentOS 7 minimal

After install and configure network under CentOS 7 minimal I continue with LAMP section. Since the machine has 4GB memory I prefer to use old fashion LAMP. Only switch MySQL with MariaDB :-)

The steps for LAMP installation for my own reference and my vps need :

Install required Package

Install nano

# yum install nano

Install Apache, PHP and MariaDB

# yum install httpd mariadb-server mariadb php php-mysql php-mysqli php-gd php-pear php-mbstring

Configure Apache

Start httpd

# systemctl start httpd.service

Set httpd to auto start after reboot or boot process

# systemctl enable httpd.service
ln -s ‘/usr/lib/systemd/system/httpd.service’ ‘/etc/systemd/system/’

By default firewall will block access. To exclude http from firewall block :

# firewall-cmd --permanent --add-service http

# systemctl restart firewalld.service

Try visit ip address from browser


Configure MariaDB

Start mariadb

# systemctl start mariadb

Set mariadb to autostart

# systemctl enable mariadb.service
ln -s ‘/usr/lib/systemd/system/mariadb.service’ ‘/etc/systemd/system/’

Set password for mariadb, delete unnecessary database and users.

# mysql_secure_installation
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found


In order to log into MariaDB to secure it, we’ll need the current
password for the root user.  If you’ve just installed MariaDB, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on…

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
… Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
… Success!

Normally, root should only be allowed to connect from ‘localhost’.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
… Success!

By default, MariaDB comes with a database named ‘test’ that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
… Success!

Cleaning up…

All done!  If you’ve completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

I also need to enable firewall to exclude future database remote backup. Port 3306 is required to open.

# firewall-cmd --permanent --add-port=3306/tcp
# systemctl restart firewalld.service


Next step is measure time needed from start server to get login display and make my report.

IBM X3250 M5 and Minimal CentOS 7

New server come. Its a IBM X3250 M5 with single HD 1TB Sata 7200 RPM. I can not see it from bios setting, my FreeBSD 9.2 CD also unable to detect it but I’ve not try it using FreeBSD 10. As I ever see various case that related with storage detection then I quickly switch to CentOS.

My preference will be CentOS 5.xx version due to application requirement (php 5.2) but now its no longer relevance. I can use newest php version and I think CentOS 7 will be fit. It will overcome storage detection and perhaps I can learn new things.

Installation work smooth since I choose DVD version but I work with minimal installation. A few notes around Minimal CentOS 7 :

# cat /etc/redhat-release
CentOS Linux release 7.0.1406 (Core)

No ifconfig command in minimal CentOS 7

# ifconfig
bash: ifconfig: command not found

Ip addr to see all network setting

# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp0s26u1u2u5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
link/ether 6e:ae:8b:5a:68:67 brd ff:ff:ff:ff:ff:ff
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 6c:ae:8b:5a:68:60 brd ff:ff:ff:ff:ff:ff
inet brd scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::6eae:8bff:fe5a:6860/64 scope link
valid_lft forever preferred_lft forever
4: eno1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
link/ether 6c:ae:8b:5a:68:61 brd ff:ff:ff:ff:ff:ff

nmcli is new friend

# nmcli -p con
NetworkManager connection profiles
NAME           UUID                                  TYPE            DEVICE
enp0s26u1u2u5  4ca8bc8e-74c5-4578-ab34-895c1c6cb7a1  802-3-ethernet  —
eno1           598b49c6-9adf-4fb7-96ee-22ebd2ee15bf  802-3-ethernet  —
eth0           2c0edb26-c2ad-42f5-80f3-3bd69b1e27e5  802-3-ethernet  eth0

Edit connection using nmtui


you’ll see screen like this

network manager TUI


edit network setting under nmtui

edit anything you want

complete network change using nmtui

The interface is pretty clear and enough for me but if really need ifconfig command

# yum install net-tools
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base:
* extras:
* updates:
Resolving Dependencies
–> Running transaction check
—> Package net-tools.x86_64 0:2.0-0.17.20131004git.el7 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

Package                               Arch                               Version                                                Repository                        Size
net-tools                             x86_64                             2.0-0.17.20131004git.el7                               base                             304 k

Transaction Summary
Install  1 Package

Total download size: 304 k
Installed size: 917 k
Is this ok [y/d/N]: y

Downloading packages:
warning: /var/cache/yum/x86_64/7/base/packages/net-tools-2.0-0.17.20131004git.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY76 kB  00:00:00 ETA
Public key for net-tools-2.0-0.17.20131004git.el7.x86_64.rpm is not installed
net-tools-2.0-0.17.20131004git.el7.x86_64.rpm                                                                                                    | 304 kB  00:00:03
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
Userid     : “CentOS-7 Key (CentOS 7 Official Signing Key) <>”
Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
Package    : centos-release-7-0.1406.el7.centos.2.3.x86_64 (@anaconda)
From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : net-tools-2.0-0.17.20131004git.el7.x86_64                                                                                                            1/1
Verifying  : net-tools-2.0-0.17.20131004git.el7.x86_64                                                                                                            1/1

net-tools.x86_64 0:2.0-0.17.20131004git.el7


network scripts still there

# ls /etc/sysconfig/network-scripts/
ifcfg-eno1           ifdown       ifdown-ipv6  ifdown-routes    ifdown-tunnel  ifup-eth   ifup-plip   ifup-routes    ifup-tunnel        network-functions-ipv6
ifcfg-enp0s26u1u2u5  ifdown-bnep  ifdown-isdn  ifdown-sit       ifup           ifup-ippp  ifup-plusb  ifup-sit       ifup-wireless
ifcfg-eth0           ifdown-eth   ifdown-post  ifdown-Team      ifup-aliases   ifup-ipv6  ifup-post   ifup-Team      init.ipv6-global
ifcfg-lo             ifdown-ippp  ifdown-ppp   ifdown-TeamPort  ifup-bnep      ifup-isdn  ifup-ppp    ifup-TeamPort  network-functions

# cat ifcfg-eth0

Free memory before install LAMP

# free -m
total       used       free     shared    buffers     cached
Mem:          3629        534       3095          8          1        342
-/+ buffers/cache:        189       3439
Swap:         3855          0       3855

# df -H
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   54G  1,1G   53G   2% /
devtmpfs                 1,9G     0  1,9G   0% /dev
tmpfs                    2,0G     0  2,0G   0% /dev/shm
tmpfs                    2,0G  9,0M  1,9G   1% /run
tmpfs                    2,0G     0  2,0G   0% /sys/fs/cgroup
/dev/sda2                521M   93M  429M  18% /boot
/dev/mapper/centos-home  942G   34M  942G   1% /home
/dev/sda1                210M   10M  200M   5% /boot/efi

So far its great :-)

How to install FTP Server (pure-ftp) on FreeBSD 10.1

This is 3rd post from virtual user hosting with FreeBSD 10 series. First two are located here :

  1. How to install virtual Ftp hosting with PureFTP on FreeBSD 10 : Part 1 – Setup
  2. How to install virtual Ftp hosting with PureFTP on FreeBSD 10 : Part 2 – TLS & Unix Auth

I restart the process using latest FreeBSD version at the moment : FreeBSD 10.1 using custom iso.

Some highlight from FreeBSD 10.1-RELEASE announcement :

  • The new console driver, vt(4), has been added.
  • Support for FreeBSD/i386 guests has been added to bhyve(4).
  • The bhyve(4) hypervisor now supports booting from a zfs(8) filesystem.
  • Support for SMP was added to the armv6 kernels and enabled by default in the configuration files for all platforms that contain multi-core CPUs.
  • Initial support for UEFI boot has been added for the FreeBSD/amd64 architecture.
  • Support has been added to cache geli(8) passphrases during system boot.
  • Support for the UDP-Lite protocol (RFC 3828) has been added to the IPv4 and IPv6 stacks.
  • The new filesystem automount facility, autofs(5), has been added.
  • The sshd(8) rc.d(8) startup script now generates ED25519 sshd(8) host keys if keys do not already exist when ssh_keygen_alg() is invoked.
  • OpenSSH has been updated to version 6.6p1.
  • The nc(1) utility has been updated to match the version in OpenBSD 5.5.
  • Sendmail has been updated to 8.14.9.
  • The unbound(8) caching resolver and ldns have been updated to version 1.4.22.
  • OpenPAM has been updated to Ourouparia (20140912).
  • OpenSSL has been updated to version 1.0.1j.
  • The pkg(8) package management utility has been updated to version 1.3.8.

Back to process :-)

# uname -rsv
FreeBSD 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 22:51:51 UTC 2014

Update Package

# pkg update
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y


Updating FreeBSD repository catalogue…
Fetching meta.txz: 100%   944 B   0.9k/s    00:01
Fetching digests.txz: 100%    2 MB 108.8k/s    00:19
Fetching packagesite.txz: 100%    5 MB  95.6k/s    00:56
Processing new repository entries: 100%
FreeBSD repository update completed. 23787 packages processed:
0 updated, 0 removed and 23787 added.

Install Ports

# portsnap fetch

# portsnap extract

# cd /usr/ports/ftp/pure-ftpd/

pure-ftpd-freebsd options

To reduce dependency compile process (download and install for each dependency), I ask for pkg help :

# pkg install dialog4ports mysql55-client perl5

Resume make install process of pure-ftp ports.

# make install

Check everything

# pkg info
dialog4ports-0.1.5_2           Console Interface to configure ports
mysql55-client-5.5.40          Multithreaded SQL database (client)
perl5-5.16.3_11                Practical Extraction and Report Language
pkg-1.3.8_3                    Package manager
pure-ftpd-1.0.36_3             Small, easy to set up, fast, and secure FTP server

Enable pureftp

#echo 'pureftpd_enable=YES' >>/etc/rc.conf

Since I want MySQL support for pure-ftp then I install MySQL server.

# pkg install mysql55-server

Enable MySQL server to start automatically after server reboot.

# echo 'mysql_enable=YES' >> /etc/rc.conf

Start MySQL server

# /usr/local/etc/rc.d/mysql-server start

According to pure-ftpd manual (mysql section).

Table structure for hold virtual user as follows :

  Uid INT(11) NOT NULL default '-1',
  Gid INT(11) NOT NULL default '-1',

Lets create that table.

# cat /etc/master.passwd | grep mysql
mysql:*:88:88::0:0:MySQL Daemon:/var/db/mysql:/usr/sbin/nologin

In my opinion Uid and Gid is 88. But as pure-ftpd manual said about 1000. I use it.

Ok, lets log in to MySQL database and insert user :

# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.40 Source distribution

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> create database ftp;
Query OK, 1 row affected (0.01 sec)

mysql> use ftp;
Database changed
mysql> CREATE TABLE users (
->   Password VARCHAR(64) BINARY NOT NULL,
->   Uid INT(11) NOT NULL default ‘-1’,
->   Gid INT(11) NOT NULL default ‘-1′,
->   PRIMARY KEY  (User)
-> );
Query OK, 0 rows affected (0.02 sec)

mysql> insert into users set User=’alamsyah’,Password=md5(‘123456′), Uid=1000,Gid=1000,Dir=’/home/ftpdata/alamsyah’;
Query OK, 1 row affected (0.00 sec)


The command above work : log in to database, create database named ‘ftp’ . Choose database ‘ftp’. Create table named ‘users’ with its structure and insert data into the table.

At this stage pure-ftpd is running, MySQL server also running. Example user also take place.


Create directory

# mkdir -p /home/ftpdata

To be able to read MySQL data, purfe-ftpd.conf need to know that.

# cd /usr/local/etc/

# mv pure-ftpd.conf.sample pure-ftpd.conf

# ee pure-ftpd.conf

remove # sign in front of MySQLConfigFile


# MySQL configuration file (see README.MySQL)

# MySQLConfigFile               /etc/pureftpd-mysql.conf

# CreateHomeDir               yes


# MySQL configuration file (see README.MySQL)

MySQLConfigFile               /usr/local/etc/pureftpd-mysql.conf

CreateHomeDir               yes

save the file.

Next step is create mysql configuration file and fill the data.

# mv pureftpd-mysql.conf.sample pureftpd-mysql.conf

# ee pureftpd-mysql.conf

The file content is well explained.

From these lines :

MYSQLUser       root

# Mandatory : user password. You must have a password.

MYSQLPassword   rootpw

# Mandatory : database to open.

MYSQLDatabase   pureftpd

# Mandatory : how passwords are stored
# Valid values are : “cleartext”, “crypt”, “sha1”, “md5” and “password”
# (“password” = MySQL password() function)
# You can also use “any” to try “crypt”, “sha1”, “md5” *and* “password”

MYSQLCrypt      cleartext

You need to change a few lines :

MysqlUser : root -> keep this as is.

MysqlPassword : not set yet, change to anything designed. For example ‘123456secret’.

MysqlDatabase : ftp (this database already created in above step).

MySQLCrypt : md5 (user alam in previous step use md5)

The rest is not changed.

save the file.

Next step is change mysql password for user root to : 123456secret.

# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.5.40 Source distribution

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> update user set password=password(‘123456secret’) where user=’root’;
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4  Changed: 4  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)


Test it

# ftp localhost
Trying …
Connected to localhost.
220———- Welcome to Pure-FTPd [privsep] [TLS] ———-
220-You are user number 1 of 50 allowed.
220-Local time is now 13:42. Server port: 21.
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
Name (localhost:alam): alamsyah
331 User alamsyah OK. Password required
230 OK. Current restricted directory is /
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> dir
229 Extended Passive mode OK (|||46398|)
150 Accepted data connection
drwxr-xr-x    2 1000       1000              512 Nov 22 13:42 .
drwxr-xr-x    2 1000       1000              512 Nov 22 13:42 ..
226-Options: -a -l
226 2 matches total

If anything is not right then you may refer to log

# tail -f /var/log/messages

If you need to enable TLS you refer to 2nd post.

See you next time!

iphone 6 case collection

My friend show me his new phone. Its iphone 6 unlocked with dimension 4.7 inch and he seem very proud. I just a bit surprise since I knew he is big fan of Android and have many gadget related such Galaxy note and samsung galaxy tab. He told me that he want to impress someone.

He want me to help him for collecting as many iphone6 case design or ready to buy iphone 6 case since he want to make surprise for someone. I agree to and try to collect it in general form. Perhaps I also need it in the future since my Lenovo S800 seem to not working well now.

I don’t know about someone that my friend talking about. His girlfriend or his family member or his working partners so I try to list my best guess. Too many case is never hurt :-)

4 things that could potentially harm your iphone 6 :

1. Dimension; old iphone version is never went to far for dimension. Newest iphone 6 plus reach 5 inch dimension that might lead to few problems. Bigger dimension mean bigger pocket and flexible storage,restrict movement and mobility. Potential harm that might occur; drop and surface scratch if other strong material exist in your pocket.

2. Environment, interactions with the environment such as dust or water that might happen like sudden exposure to water such as rain or splashing water from a party that is not planned to be anticipated from the beginning.

3. Drop, dropping a phone is another human mistake. We never unintended but often occur. Drop into solid ground often result to visual damage and drop into water lead to total damage.

4. Scratch, many factor that lead to scratch to your iphone. Choose wrong surface cover or case material.

Those potential problems are my basic assumption for creating this list, to get exact product that fit your expectation need more review since every one has their own pass list. I do my best to gather helpful link for you before make final decision.

Protection based case for Iphone 6


My friend like to visit beach, swimming pool and related water source. I think best option to protect his iphone 6 from water is waterproof iphone 6 case. A few things to consider for this kind of case are :

  • Headphone, make sure to pay attention for things that able to keep you headphone. Did the design also came with keeper to make headphone stay attached or you have to keep it manually.
  • Touch id, make sure to read other user experience. Some case is working well with water but sacrifice functionality such touch id, not responsive touch screen and force you to press hard.
  • Material, plastic is great but other manufacturer use Aluminum.
  • Ability to access all phone functionality.
  • Proper series, brand like otterbox have a few series. Choose the series that many people use.


The natural location of phone is pocket for many case. At least once in lifetime every person drops their phone. Shockproof protection is basic need for me. Apple might change the material they choose for iphone 6 but customer can prevent it from unknown disaster after unexpected drops. Urban Armor Gear is great product. They create sleek interface that warranted for 12 month and received 4++ rating in average from Amazon customer.

All in one protection iphone 6 case

Some manufacturer also develop many protection for their case. Waterproof, water resist, dust proof, shockproof in one product. Many of them under $40 with the range of $15-$36. I’m practical person, I tend to seek other experience. When I have to choose for example waterproof case for iphone 6 then I prefer to use 4++ rating and if possible rated more than 100 person.

Branded iphone 6 case

Griffin survivor  iphone 6 case

During my search, I found about brand that seem to focus on meet or exceed standard of US Department of Defense MIL-STD-810G. Passion is great when it has target. I think other brand also have their own standard but If you can deliver military standard with great price then you are in good path. Griffin also know as brand that often released earlier then their competitor.


Another famous brand that get rating 4++ in average for most of their product series. Temporarily out of stock status in their storefront for some series also make curious to read the reviews. Specially when I see more than 600 users give their voice.

Custom iphone 6 case

Custom iphone 6 case often designed for specific purpose like gift. A few manufactures provide many design submitted by ordinary person that sometime has deep expression. Ability to give small but meaningful touch often work well many situation like; personal name printed in your iphone 6 case.

As the technology always changing I’ll update this post if I found something new that appropriate. More with customer review since their voice is loud and reflect the product in real world use.

How to install virtual Ftp hosting with PureFTP on FreeBSD 10 : Part 2 – TLS & Unix Auth

In 1st part of this post I have very general setting for pure-ftp configured. In this post we’ll explore about testing functionality of this ftp server using simple auth plus how configure TLS section.

To test the server I need to add user. I used to use sysinstall for this purpose but since sysinstall no longer available on FreeBSD then I use bsdconfig.

Introduce bsdconfig

From bsconfig manual :

bsdconfig is used to set up many system configuration settings, both for
new systems, as well as changing configuration settings of existing systems.

bsdconfig optionally takes    a command as an    argument.  If invoked with no arguments,
it will bring up an interactive    menu listing the available modules.

I like gui version so I type bsdconfig or you can use full path : /usr/sbin/bsdconfig

If not available you can install it.

From ports

# /usr/ports/sysutils/bsdconfig && make install

From pkg

# pkg install bsdconfig

For pure-ftp purpose I need bsdconfig for add new user :


Choose “Login/Group Management”

bsdconfig as sysinstall replacement

read more »