Panduan Instalasi Nginx, PHP 5, MySQL di CentOS 6.3


Panduan Instalasi Nginx dan PHP 5 di CentOS 6.3


Tambahkan beberapa repositori EPEL.

rpm --import https://fedoraproject.org/static/0608B895.txt
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm
rpm --import http://rpms.famillecollet.com/<span class="zem_slink">RPM</span>-GPG-KEY-remi
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

Instalasi yum-priorities

yum install yum-priorities

Nah, setelah itu…
Kita harus mengedit file EPEL yang terletak di /etc/yum.repos.d/epel.repo

vi /etc/yum.repos.d/epel.repo

Yang perlu ditambahkan adalah priority=10 dibagian [epel]

Berikut kutipannya :


[epel]
name=Extra Packages for <a class="zem_slink" title="Red Hat Enterprise Linux" href="http://www.redhat.com/rhel/" target="_blank" rel="homepage">Enterprise Linux</a> 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
priority=10
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
[...]

 

Dan, lakukan juga di bagian [remi] pada /etc/yum.repos.d/remi.repo dan ganti enabled menjadi parameter 1

vi /etc/yum.repos.d/remi.repo

[remi]
name=Les RPM de remi pour Enterprise Linux $releasever - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/$releasever/remi/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/$releasever/remi/mirror
enabled=1
priority=10
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
failovermethod=priority[remi-test]
name=Les RPM de remi en test pour Enterprise Linux $releasever - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/$releasever/test/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/$releasever/test/mirror
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

Nah, sekarang kita menginstal MySql

yum install mysql mysql-server

 

Lalu kita buat agar jalan auto.

chkconfig --levels 235 mysqld on
 /etc/init.d/mysqld start

 

Nah kita cek, apakah mysql sudah berjalan ataukah belum.
Dengan perintah berikut :

netstat -tap | grep mysql

Jika belum ada,

vi /etc/my.cnf

 


[...]
#skip-networking
[...]

Lalu, restart /etc/init.d/mysqld restart

Setelah itu kita konfigurasi pertama kali.
Jalankan : mysql_secure_installation



[root@elmoony ~]# mysql_secure_installation

 NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL <a class="zem_slink" title="MySQL" href="http://www.mysql.com" target="_blank" rel="homepage">MySQL</a>
       SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

 In order to log into MySQL to secure it, we'll need the current
 password for the <a class="zem_slink" title="Superuser" href="http://en.wikipedia.org/wiki/Superuser" target="_blank" rel="wikipedia">root user</a>.  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: <-- passwordSQLanda
 Re-enter new password: <-- ulangipasswordnya
 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@elmoony ~]#


Lalu, kemudian kita install nginx-nya🙂

yum install nginx
chkconfig --levels 235 nginx on
/etc/init.d/nginx start

Kemudian, yang terakhir kita melakukan instalasi PHP5

yum install php-fpm php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-magickwand php-magpierss php-mbstring php-mcrypt php-mssql php-shout php-snmp php-soap php-tidy

Kemudian, install APC

yum install php-pecl-apc

 

Lalu edit file /etc/php.ini dan set cgi.fix_pathinfo=0:aaa

<pre>[...]
; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for <a class="zem_slink" title="Computer-generated imagery" href="http://en.wikipedia.org/wiki/Computer-generated_imagery" target="_blank" rel="wikipedia">CGI</a>.  PHP's
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok
; what PATH_INFO is.  For more information on PATH_INFO, see the cgi specs.  Setting
; this to 1 will cause PHP CGI to fix its paths to conform to the spec.  A setting
; of zero causes PHP to behave as before.  Default is 1.  You should fix your scripts
; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.
; http://www.php.net/manual/en/ini.core.php#ini.cgi.fix-pathinfo
cgi.fix_pathinfo=0
[...]
chkconfig --levels 235 php-fpm on
 /etc/init.d/php-fpm start

 

PHP-FPM termasuk dalam proses daemon (dengan init script /etc/init.d/php-fpm) maka FastCGI akan berjalan pada server di port 9000

Referensi :

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s