Build your own LAMP Server under CentOS


MySQL

Install MySQL

yum -y install openssh-server openssh-clients

Startup MySQL, then go through the setup process

iptables -n -L -v --line-numbers

You will be prompted for information during the install. Set your root password for the MySQL database at this time, also remove the anonymous user access and the test database.

Now we will add MySQL support for PHP. If you need certain packages installed you can browse the ones available through the yum repository by typing yum search php. This will output all the available packages, and you can search for the ones you need, or use my defaults listed below. The php-mysql is required to get the two working together, and the remainders are up to you based on your needs.

[root@localhost /]# iptables -n -L -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
num   pkts bytes target     prot opt in     out     source               destination         
1      705 65371 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 
2        0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           
3        2   120 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0           
4       29  5379 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited 
 
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num   pkts bytes target     prot opt in     out     source               destination         
1        0     0 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited

After install, restart Apache

iptables -I INPUT 4 -m tcp -p tcp --dport 22 -j ACCEPT
service iptables save

If you now go to the info.php page created earlier you will see the modules installed.


phpMyAdmin

phpMyAdmin is not available through the yum repository, so we have to add the DAG package.

[root@localhost /]# iptables -n -L -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
num   pkts bytes target     prot opt in     out     source               destination         
1      705 65371 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 
2        0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           
3        2   120 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0    
4        1    52 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22       
5       29  5379 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited

If installing on a 64bit system (x86_64) do

nano -w /etc/ssh/sshd_config

On 32bit (i386) use

PermitRootLogin yes

Then install

service sshd restart

Configure to allow access remotely and not just from the localhost.

nano -w /etc/httpd/conf.d/phpmyadmin.conf

Change to look like the following for the section <Directory “/usr/share/phpmyadmin”>

#
#  Web application to manage MySQL
#
 
#&lt;Directory "/usr/share/phpmyadmin"&gt;
#  Order Deny,Allow
#  Deny from all
#  Allow from 127.0.0.1
#
 
Alias /phpmyadmin /usr/share/phpmyadmin
Alias /phpMyAdmin /usr/share/phpmyadmin
Alias /mysqladmin /usr/share/phpmyadmin

Now we edit the configuration to change from cookie to http:

nano -w /usr/share/phpmyadmin/config.inc.php

Locate and change the following in the file

/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'http';

Restart Apache

service httpd restart

Now you can logon to phpMyAdmin via the browser (ie: http://192.168.1.200/phpmyadmin/)

Tagged , , , , , , , , . Bookmark the permalink.

Comments are closed.