[CentOS] LAMP & Suhosin & APC & IonCube Loader & Optimization

Status
Not open for further replies.

eXXed

Active Member
95
2010
0
0
Hi guys this my first tutorial Hope you like it
In this tutorial we will have Fresh CentOS installed on VPS with RAM 512D/1024B .
and this is exclusive installation of MySQL (5.1.47 MySQL Community Server (GPL) by Remi) and PHP 5.3.2 By Remi too with Suhosin Extension 0.9.31 & Ioncube Loader & APC for Caching and PHP Optimizing

Note: this is what i have installed on my VPS for my site ttrtt.com and it's using 300MB RAM only

Let's Start:
First Login to your VPS Shell as root copy 'n past following :
Code:
[COLOR=Red]wget[/COLOR] [COLOR=Blue]http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm[/COLOR]
[COLOR=Red]wget [/COLOR][COLOR=Blue]http://rpms.famillecollet.com/enterprise/remi-release-5.rpm[/COLOR]
[COLOR=Red]rpm -Uvh[/COLOR] [COLOR=Blue]remi-release-5*.rpm epel-release-5*.rpm[/COLOR]
[COLOR=Red]wget[/COLOR] [COLOR=Blue]http://rpms.famillecollet.com/RPM-GPG-KEY-remi[/COLOR]
[COLOR=Red]rpm [/COLOR][COLOR=Blue][COLOR=Red]--import[/COLOR] RPM-GPG-KEY-remi[/COLOR]
[COLOR=Red]rpm [/COLOR][COLOR=Blue][COLOR=Red]-q[/COLOR] gpg-pubkey --qf "%{summary} ->%{version}-%{release}\n"[/COLOR]
OK now lets upgrade our system and install the required libraries copy 'n past following :
Code:
[COLOR=Red]yum update[/COLOR]
MySQL: =)
OK after this lets install MySQL server and then upgrade it
Code:
[COLOR=Red]yum install[/COLOR] [COLOR=Blue]mysql-server[/COLOR]
[COLOR=Red]chkconfig --levels 235[/COLOR] [COLOR=Blue]mysqld on[/COLOR]
[COLOR=Red]/etc/init.d/mysqld[/COLOR] [COLOR=Blue]start[/COLOR]
then this :
Code:
[COLOR=Red]/usr/bin/mysql_secure_[/COLOR][COLOR=Red]installation[/COLOR]
now he will ask you to set root password and disabling remote connection to mysql server just follow the instructions and everything will be fine....
Upgrading : =)
Code:
[COLOR=Red]/etc/init.d/mysqld [COLOR=Blue]stop[/COLOR][/COLOR]
[COLOR=Red]yum --enablerepo remi update[/COLOR] [COLOR=Blue]mysql-server[/COLOR]
[COLOR=Red]/etc/init.d/mysqld [COLOR=Blue]start[/COLOR][/COLOR]
Apache Server: =)
Now we will install Apache Server just copy 'n past :
Code:
[COLOR=Red]yum install[/COLOR] [COLOR=Blue]httpd[/COLOR]
[COLOR=Red]chkconfig --levels 235[/COLOR] [COLOR=Blue]httpd on[/COLOR]
[COLOR=Red]/etc/init.d/httpd[/COLOR] [COLOR=Blue]start[/COLOR]
PHP: =)
Now installing php and then upgrading it:
Code:
[COLOR=Red]yum install[/COLOR] [COLOR=Blue]php php-bcmath php-cli php-gd php-mbstring php-mcrypt php-mysql
[/COLOR][COLOR=Red]/etc/init.d/httpd [COLOR=Blue]restart[/COLOR][/COLOR]
Upgrading : =)
Let's upgrade PHP to 5.3.2 using remi repo
Code:
[COLOR=Red]yum --enablerepo remi update [/COLOR][COLOR=Blue]php[/COLOR]
[COLOR=Red]/etc/init.d/httpd[/COLOR] [COLOR=Blue]restart[/COLOR]
APC : =)
Code:
[COLOR=Red]yum --enablerepo remi[/COLOR] [COLOR=Red]install [/COLOR][COLOR=Blue]php-devel[/COLOR]
[COLOR=Red]yum --enablerepo remi[/COLOR] [COLOR=Red]install [/COLOR][COLOR=Blue]php-pecl-apc[/COLOR]
[COLOR=Red]/etc/init.d/httpd[/COLOR] [COLOR=Blue]restart[/COLOR]
SuHosin : =)
Let's install Suhosin it's so simple :
Code:
[COLOR=Red]yum install[/COLOR] [COLOR=Blue]gcc[/COLOR]
[B]yum install make (some VPS it's not installed by default)[/B]
[COLOR=Red]cd[/COLOR] [COLOR=Blue]/opt[/COLOR]
[COLOR=Red]wget[/COLOR] [COLOR=Blue]http://download.suhosin.org/[/COLOR][COLOR=Blue]suhosin-0.9.31.tgz[/COLOR]
[COLOR=Red]tar[/COLOR] [COLOR=Red]-xf[/COLOR] [COLOR=Blue]suhosin-0.9.31.tgz[/COLOR]
[COLOR=Red]cd[/COLOR] [COLOR=Blue]suhosin-0.9.31[/COLOR]
[COLOR=Red]phpize[/COLOR]
[COLOR=Red]./configure[/COLOR]
[COLOR=Red]make[/COLOR]
[COLOR=Red]make install[/COLOR]
[COLOR=Red]echo 'extension=suhosin.so' > /etc/php.d/suhosin.ini[/COLOR]
[COLOR=Red]/etc/init.d/httpd[/COLOR] [COLOR=Blue]restart[/COLOR]
Now lets test suhosin if it's installed in shell type the following command :
Code:
[COLOR=Red]php [/COLOR][COLOR=Blue]-v[/COLOR]
IonCube Loader : =)
1. Download ioncube loader with wget

Code:
[COLOR=Red]tar -xf [/COLOR][COLOR=Blue]ioncube_loaders_lin_*.[/COLOR][COLOR=Blue]tar.gz[/COLOR]
[COLOR=Red]cd [/COLOR][COLOR=Blue]ioncube[/COLOR]
[COLOR=Red]mv [/COLOR][COLOR=Blue]loader-wizard.php /var/www/html[/COLOR]
[COLOR=Red]cd [/COLOR][COLOR=Blue]..[/COLOR]
[COLOR=Red]mv [/COLOR][COLOR=Blue]ioncube /usr/local/[/COLOR]
now go to http://your_vps_ip/loader-wizard.php
and follow the instruction there i won't type it here coz it's so simple
now to let your server work like a charm just do this command
Code:
chown -hR apache:apache /var/www/html
be careful do this command after uploading your all files in this /var/www/html
----------------->><<-----------------
Optimizing MySQL with my.cnf file
edit /etc/my.cnf with vi or nano command copy 'n past :
Code:
[mysqld]
max_connections = 100
key_buffer = 32M
myisam_sort_buffer_size = 32M
join_buffer_size = 1M
read_buffer_size = 1M
sort_buffer_size = 2M
table_cache = 4000
thread_cache_size = 286
interactive_timeout = 25
wait_timeout = 7000
connect_timeout = 10
max_allowed_packet = 16M
max_connect_errors = 10
query_cache_limit = 2M
query_cache_size = 12M
query_cache_type = 1
tmp_table_size = 16M
skip-innodb
[mysqld_safe]
open_files_limit = 8192
[mysqldump]
quick
max_allowed_packet = 16M
[myisamchk]
key_buffer = 64M
sort_buffer = 64M
read_buffer = 16M
write_buffer = 16M
[mysqlhotcopy]
interactive-timeout
that's all
if u need help post your probs here
 
4 comments
Status
Not open for further replies.
Back
Top