Install Linux with Nginx, PHP5 (And PHP-FPM) And MySQL Support On CentOS (Part 1)

I want to save my documentation on my web server installation, I use centos server and configure it with nginx, PHP5, php-fpm, and mysql.

First of all, I use the hostname server1.mylocal.com with the IP address

Now we begin.
First I need to enable additional repo because php-fpm is not available from the official CentOS repositories, but from the Remi RPM repository which itself depends on the EPEL repository; I enable both repositories as follows:
rpm --import https://fedoraproject.org/static/0608B895.txt
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.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
Edit the /etc/yum.repos.d/epel.repo and add priority=10 to the epel section.
Edit the /etc/yum.repos.d/remi.repo, and add  priority=10 to the remi section, and change to enable=1

Now we're ready to install the softwares.

1. Install MySQL 5
yum install mysql mysql-server
first thing to do after installing a server software is to create a system startup link, so that MySQL starts automatically whenever the system boots.
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
check /etc/my.cnf and make sure the option skip-networking is commented out (not having # mark in front of the line), then restart mysql
/etc/init.d/mysqld restart
then run MySQL setup configuration to setup MySQL root password:

[root@server1 ~]# mysql_secure_installation


In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, 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):
 <-- ENTER
OK, successfully used password, moving on...

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

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

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL 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]
 <-- ENTER
 ... 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]
 <-- ENTER
 ... Success!

By default, MySQL 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] <-- ENTER
 - 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]
 <-- ENTER
 ... Success!

Cleaning up...

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

Thanks for using MySQL!

[root@server1 ~]#

End of part 1

No comments: