How to Install MySQL 5
In order to install MySQL 5, follow the procedure given below;
yum install mysql mysql-server
After the installation of MySQL 5, make the system startup links for MySQL – it will automatically initiate MySQL every time the system boots – and start the MySQL server:
chkconfig --levels 235 mysqld on
Now create passwords for the MySQL root account.
Current password is required for the root user to log into MySQL to make it protected. If you are unable to set the root password up till now, so you need to press enter here.
Write current password for root:
OK, now you can easily use password, moving on...
By creating the root password helps you to ensure that nobody can misuse MySQL without your permission.
Set root password? [Y/n] <-- ENTER
New password: <-- yourrootsqlpassword
Re-enter new password: <-- yourrootsqlpassword
Password updated successfully!
Reloading privilege tables..
There is a built in anonymous user in MySQL installation, which authorize anyone to log into MySQL even he/she does not has a user account. This is because for testing purpose only, and to make the installation a bit easier for the user. You have the authority to delete it before going into a production environment.
Remove anonymous users? [Y/n] <-- ENTER
In normal circumstances, you can only connect from ‘localhost’ via root. This makes sure that no one can easily assume at the root password from the network.
Disallow root login remotely? [Y/n] <-- ENTER
MySQL originally comes with a database, having a title name ‘test’, so that any user can use it. This is also because for testing purpose, and should be deleted before going into a production environment.
Remove test database and access to it? [Y/n] <-- ENTER
- Dropping test database...
- Removing privileges on test database...
Reloading the privilege tables will make sure that the changes you have made till now are in effect immediately.
By reloading the privilege tables will eventually help to make certain that all modifications that have been made yet will take effect immediately.
Reload privilege tables now? [Y/n] <-- ENTER
The installation process has been completed.
How to Install Lighttpd
Since Lighttpd and PHP-FPM cannot be obtainable from the official CentOS database, so we have to use the Remi PRM database and EPEL database.
rpm --import https://fedoraproject.org/static/0608B895.txt
rpm -ivh epel-release-6-7.noarch.rpm
rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
yum install yum-priorities
... and add the line priority=10 to the [epel] section:
name=Extra Packages for Enterprise Linux 6 - $basearch
Then do the same for the [remi] section in /etc/yum.repos.d/remi.repo, plus change enabled to 1:
name=Les RPM de remi pour Enterprise Linux $releasever - $basearch
name=Les RPM de remi en test pour Enterprise Linux $releasever - $basearch
Now, we can install Lighttpd through this process:
yum install lighttpd
Now make the required system startup links for Lighttpd (so that it can automatically initiate Lighttpd every time the system boots) and start it:
chkconfig --levels 235 lighttpd on
In case Lighttpd is unable to start with the given message…
(network.c.203) socket failed: Address family not supported by protocol
... open /etc/lighttpd/lighttpd.conf...
... and change server.use-ipv6 from enable to disable:
## Use IPv6?
server.use-ipv6 = "disable"
Again start Lighttpd, and it will definitely work without any issue.
Now type this address on your browser http://192.168.0.100, and this page will appear on your computer screen.
Lighttpd's default document root is /var/www/lighttpd/ on CentOS 6.3, and the configuration file is /etc/lighttpd/lighttpd.conf.
How to Install PHP5
PHP5 can be made compatible with Lighttpd with the help of PHP-FPM which we install in this way:
yum install php-fpm lighttpd-fastcgi
PHP-FPM is a daemon process that runs a FastCGI server on port 9000.
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
; RPM: apache Choosed to be able to access some dir as httpd
user = lighttpd
; RPM: Keep a group allowed to write in log dir.
group = lighttpd
Now make the system startup links for PHP-FPM and start using it:
chkconfig --levels 235 php-fpm on