centos6.0LAMP原始碼安裝
說明:在本帖中,#代表shell的提示符,所有操作均在root環境變數下面執行
一,系統的安裝
系統安裝的是centos6.0版本,磁碟大小300G
- /boot 300M
- /swap 2G
- / 30G
- /usr/local 80G
- /var 80G //lvm分割槽
- /home 20G
- /tmp 10G
安裝好之後,配置ip地址,ssh,iptables等服務,安裝系統的原則:最小化安裝,儘量不安裝圖形介面和不必要的軟體包。
二,軟體包的準備
mysql-5.6.2-m5,php-5.3.6,httpd-2.2.21
下載地址
- #cd /usr/local/src
- #wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.2-m5.tar.gz
- #wget http://mirrors.sohu.com/php/php-5.3.6.tar.gz
-
#wget http://mirrors.sohu.com/apache/httpd-2.2.21.tar.gz
三,本機yum源的配置
- #vim /etc/yum.repos.d/myyum.repo
- [Packages]
- name=CentOS-$releasever – Plus
- baseurl=file:///mnt/cd/ #本地檔案路徑,如果是網路源,請更改
- gpgcheck=1 #gpg校驗
- enabled=1 #yum的開關
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
- #yum clean all
- #yum list
四,安裝系統編譯環境所需要的軟體包
for base in gcc gcc-c++ make cmake apr apr-util postgresql-libs zlib* openssl openssl-devel autoconf automake ncurses* libtool* libxslt libxslt-devel libxml* curl* bzip2* gd gd-devel freetype freetype-devel libpng* cairo-devel libxml2-devel pango pango-devel libmcrypt libpng jpeg bison mysql-devel
do rpm -qa |grep $base;retval=$?
[ “$retval” != 0 ] && yum install $base done
注意,以上步驟需要把yum源等配置好,然後複製紫色字型到指令碼執行
(主要是安裝gcc make以及GD及庫相關 curl libpng zlib freetype libxslt jpegsrc gd libxml )
五,apache的編譯安裝
- #service httpd stop //為了防止系統安裝的時候預設安裝過apache
- #rpm -e –nodeps httpd
- #tar xvf httpd-2.2.21.tar.gz
- #cd httpd-2.2.21
- #groupdel Apache
- #groupdel apache
- #userdel apache
- #groupadd –gid=48 apache
- #useradd -s /sbin/nologin -d /usr/local/apache2 -g apache –uid=48 apache
- #./configure –prefix=/usr/local/apache2 –enable-deflate –enable-headers –enable-so –with-mpm=worker –enable-rewrite –enable-cgi –enable-file-cache –enable-cache –enable-disk-cache –enable-mem-cache –enable-static-ab –enable-static-htpasswd –enable-expires –enable-authn-dbm –with-ssl –enable-ssl –disable-userdir –disable-cgid –enable-expires –enable-speling
- #make && make install
- #ln -s /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
- #chown -R apache:apache /usr/local/apache2
- #service httpd restart
- ——————————————————
- #echo `service httpd restart` >> /etc/rc.d/rc.local 如果前面有ln -s 此處去掉
- ——————————————————
- #sed -i `s/User daemon/User apache/g` /usr/local/apache2/conf/httpd.conf
- #sed -i `s/Group daemon/Group apache/g` /usr/local/apache2/conf/httpd.conf
- #cd ..
六,mysql的安裝過程
- #tar xvf mysql-5.6.2-m5.tar.gz
- #cd mysql-5.6.2-m5
- #mkdir /usr/local/mysql
- #groupdel mysql
- #userdel mysql
- #groupadd mysql
- #useradd -d /var/lib/mysql -s /bin/bash -g mysql mysql
- —————————————————————–
- #wget http://googletest.googlecode.com/files/gtest-1.5.0.tar.gz
- #cp gtest-1.5.0.tar.gz mysql-5.6.2-m5/source_downloads
- ——————————————————————
- **********此處需要注意的是如果沒有下載gtest,安裝的過程會自動去下載gtest,需要將以下的引數改變成這樣-DENABLE_DOWNLOADS=1
- # cmake . -DINSTALL_LIBDIR=/usr/local/mysql -DMYSQL_DATADIR=/var/mysql/data -DSYSCONFDIR=/etc -DDEFAULT_CHARSET=utf8 -DDEFAULT_ COLLATION=utf8_general_ci -DWITH_SSL=system -DWITH_EMBEDDED_SERVER=1 -DENABLE_DOWNLOADS=0 -DENABLED_LOCAL_INFILE=1 -DWITH_MY ISAM_STORAGE_ENGINE=1 -DMYSQL_TCP_PORT=3306 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DWITH_LIBWRA P=1 -DWITH_DEBUG=0
- #chown -R mysql /usr/local/mysql
- #chgrp -R mysql /usr/local/mysql
- #make && make install
- #cp support-files/my-medium.cnf /etc/my.cnf
- #cp support-files/mysql.server /etc/init.d/mysqld
- #chmod 755 /etc/init.d/mysqld
- #chown -R root:mysql /usr/local/mysql/
- #chown -R mysql:mysql /usr/local/mysql/data
- #sed -i `/^[mysqld]$/a set-variable=max_connections=2000` /usr/local/mysql/etc/my.cnf
- #cp extra/my_print_defaults /usr/local/mysql/bin/
- #mkdir -p /var/lib/mysql/data
- #mkdir /var/run/mysqld
- #chown -R mysql:mysql /var/run/mysqld
- #chmod 755 -R /var/mysql/data/
- #chkconfig –add mysqld
- #chkconfig mysqld on
- #/usr/local/mysql/scripts/mysql_install_db –user=mysql –basedir=/usr/local/mysql/ –datadir=/var/mysql/data
- #/usr/local/mysql//bin/mysqld_safe &
- #ln -s /usr/local/mysql/bin/mysql /bin/mysql
- #service mysqld restart &&
- #cd ..
- 需要注意的是:本處只是把mysql安裝好了,對系統引數並沒有做設定,大家可以參考其他mysql調優
- 資源進行相關的設定
七,php的安裝過程
- #tar xvf libmcrypt-2.5.8.tar.gz
- #cd libmcrypt-2.5.8
- #./configure –prefix=/usr/local/
- #make && make install
- #cd ..
- #tar xvf mhash-0.9.9.9.tar.gz
- #cd mhash-0.9.9.9
- #./configure –prefix=/usr/local/
- #make && make install
- #cd ..
- #tar xvf mcrypt-2.6.8.tar.gz
- #cd mcrypt-2.6.8
- #LD_LIBRARY_PATH=/usr/local/lib ./configure –prefix=/usr/local/
- #make && make install
- #cd ..
-
- #wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
- #tar xvf libiconv-1.14.tar.gz
- #cd libiconv-1.14
- # ./configure –prefix=/usr/local
- #make && make install
- #cd ..
- #tar xvf freetype-2.4.0.tar.gz
- #cd freetype-2.4.0
- #./configure
- #make && make install
- #cd ..
- # wget http://downloads.sourceforge.net/project/libpng/libpng14/older-releases/1.4.2/libpng-1.4.2.tar.gz
- #tar xvf libpng-1.4.2.tar.gz
- #cd libpng-1.4.2
- #./configure
- #make && make install
- #wget http://www.netpurgatory.com/web_stuff/zeusmp_releases/jpegsrc.v6b.tar.gz
- #./configure –enable-static –enable-shared
- #mkdir /usr/local/man/man1
- #—-If your system was install libxml2, you do not need to install it.—-
- #wget ftp://xmlsoft.org/libxml2/libxml2-2.7.6.tar.gz
- #tar xvf libxml2-2.7.6.tar.gz
- #cd libxml2-2.7.6
- #./configure
- #make && make install
- *******************************install php*********************************
- #tar xvf php-5.3.6.tar.gz
- #cd php-5.3.6
- ****************注意此處進行2處連結,同時將–with-mysql=/usr/local/mysql改為–with-mysql=/usr,防止提示configure: error: Cannot find libmysq
- lclient under /usr/local/mysql的錯誤*******************
- #ln -s /usr/local/mysql/libmysqlclient_r.a /usr/lib/libmysqlclient_r.a
- #ln -s /usr/local/mysql/libmysqlclient.a /usr/lib/libmysqlclien.a
- #./configure –prefix=/usr/local/php5 –with-config-file-path=/usr/local/php5/ –with-mysql=/usr –with-mysql-sock=/tmp/mysql.
- sock –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql –with-bz2 –with-jpeg-dir –with-png-dir –with-freetype-dir –w
- ith-libxml-dir=/usr/local –with-zlib-dir –with-gd –enable-gd-native-ttf –with-xsl –with-openssl-dir –with-mcrypt –e
- nable-zip –enable-sqlite-utf8 –enable-sockets –enable-soap –enable-ucd-snmp-hack –enable-ftp –enable-safe-mode –enab
- le-bcmath –enable-sysvsem &&
- ***********加此引數防止make的時候報make: *** [sapi/cli/php] Error 1的錯誤********
- 用sed命令替換如下
- #sed -i `s/-lm -lxslt -lxml2 -lz -lm -lcrypt/-lm -lxslt -lxml2 -lz -lm -lcrypt -liconv/g` Makefile
- #make && make install
- #cp php.ini-development /usr/local/php5/php.ini
- ******php測試頁面的自動生成,如果各位自行定義了apche的路徑,下面的語句也需要改變*****
- #echo -e “<?php
phpinfo();
?>” >/usr/local/apache2/htdocs/test.php - ********讓apache對php進行支援,需要更改3個地方******
- #sed -i `/AddType application/x-gzip .gz .tgz$/a AddType application/x-httpd-php .php .phtml` /usr/local/apache
- 2/conf/httpd.conf
- #sed -i `/AddType application/x-httpd-php .php .phtml$/a AddType application/x-httpd-php-source .phps` /usr/lo
- cal/apache2/conf/httpd.conf
- #sed -i `/Group apache$/a LoadModule php5_module libexec/libphp5.so` /usr/local/apache2/conf/httpd.conf
- sed -i `/\ LoadModul foo_modules modules/mod_foo.so$/a LoadModule php5_module libexec/libphp5.so` /usr/local/apache2/c
- onf/httpd.conf
- #service httpd restart
八,測試調優:通過以上步驟的安裝,系統框架已經可以搭建好了,接下來需要各位自己對各引數進行相關的優化設定
請大家自己設定,本文不再詳述,如有不足之處,請大家指教。
本文轉自it你好 51CTO部落格,原文連結:http://blog.51cto.com/itnihao/680772,如需轉載請自行聯絡原作者
相關文章
- LAMP原始碼安裝+wordpress安裝LAMP原始碼
- nginx原始碼安裝Nginx原始碼
- 原始碼安裝postgresql原始碼SQL
- 原始碼安裝openresty原始碼REST
- 原始碼安裝GO原始碼Go
- Nginx 原始碼安裝Nginx原始碼
- mysql原始碼安裝MySql原始碼
- zabbix原始碼安裝原始碼
- 原始碼安裝lamp原始碼LAMP
- 原始碼安裝MySQL原始碼MySql
- 原始碼安裝Nginx原始碼Nginx
- 【推薦 - 原始碼安裝】nginx - 安裝原始碼Nginx
- yum安裝與原始碼安裝比較原始碼
- MySQL 5.7.28 原始碼安裝MySql原始碼
- docker原始碼安裝NginxDocker原始碼Nginx
- macbook 原始碼安裝 redisMac原始碼Redis
- macbook 原始碼安裝 nginxMac原始碼Nginx
- Centos原始碼安裝NginxCentOS原始碼Nginx
- Redis 4.0原始碼安裝Redis原始碼
- mysql 5.1原始碼安裝MySql原始碼
- mysql-原始碼安裝MySql原始碼
- 原始碼安裝python原始碼Python
- MYSQL 5.6.27原始碼安裝MySql原始碼
- PostgreSQL 10.12 安裝系列 - 原始碼安裝SQL原始碼
- Mysql for Linux安裝配置之—— 原始碼安裝MySqlLinux原始碼
- 連網安裝mysql與原始碼安裝mysqlMySql原始碼
- PostgreSQL-原始碼安裝(一)SQL原始碼
- 原始碼安裝Nginx和PHP原始碼NginxPHP
- 原始碼包安裝過程原始碼
- 原始碼安裝PHP的坑原始碼PHP
- paramiko 2.4.1原始碼安裝原始碼
- 原始碼編譯安裝Redis原始碼編譯Redis
- EOS原始碼分析(1)安裝原始碼
- LAMP原始碼編譯安裝LAMP原始碼編譯
- 安裝mysql原始碼出錯MySql原始碼
- MySQL 5.6.26原始碼安裝MySql原始碼
- Percona XtraBackup 原始碼安裝原始碼
- LNMP 原始碼安裝搭建薦LNMP原始碼