第一步
為城步等地區(qū)用戶提供了全套網(wǎng)頁(yè)設(shè)計(jì)制作服務(wù),及城步網(wǎng)站建設(shè)行業(yè)解決方案。主營(yíng)業(yè)務(wù)為網(wǎng)站建設(shè)、網(wǎng)站制作、城步網(wǎng)站設(shè)計(jì),以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專(zhuān)業(yè)、用心的態(tài)度為用戶提供真誠(chéng)的服務(wù)。我們深信只要達(dá)到每一位用戶的要求,就會(huì)得到認(rèn)可,從而選擇與我們長(zhǎng)期合作。這樣,我們也可以走得更遠(yuǎn)!1、安裝編譯工具 gcc*
安裝數(shù)據(jù)庫(kù)編譯工具 cmake bison
yum -y install gcc* cmake bison
2、下載LAMP壓縮包:lamp.zip ,使用腳本批量解壓 tar.sh
3、關(guān)閉防火墻、Selinux
第二步
分別編譯安裝各個(gè)源碼包(共有17個(gè)包)
1、可以直接安裝的源碼包
2.1、 # 安裝libxml2
先安裝 yum -yinstall python-devel
mkdir /usr/local/libxml2/
cd /lamp/libxml2-2.9.1
./configure--prefix=/usr/local/libxml2/ && make&& make install
2.2、# 安裝libmcrypt
mkdir /usr/local/libmcrypt/
cd /lamp/libmcrypt-2.5.8
./configure --prefix=/usr/local/libmcrypt/ && make && make install
2.3、# 安裝libltdl
也在libmcrypt源碼目錄中
cd/lamp/libmcrypt-2.5.8/libltdl
./configure--enable-ltdl-install && make && make install
2.4、# 安裝 mhash
cd /lamp/mhash-0.9.9.9
./configure && make && make install
2.5、# 安裝mcrypt
cd/lamp/mcrypt-2.6.8
LD_LIBRARY_PATH=/usr/local/libmcrypt/lib:/usr/local/lib./configure
--with-libmcrypt-prefix=/usr/local/libmcrypt
make && make install
2.6、# 安裝zlib
cd /lamp/zlib-1.2.3
./configure
vi Makefile
將 CFLAGS=-O3 -DUSE_MMAP
修改為CFLAGS=-O3 –DUSE_MMAP –fPIC
make&& make install
2.7、# 安裝libpng
mkdir /usr/local/libpng/
cd /lamp/libpng-1.2.31
./configure--prefix=/usr/local/libpng/ && make&& make install
2.8、# 安裝jpeg6
必須先安裝 yum -y install"libtool*"
mkdir/usr/local/jpeg6
mkdir/usr/local/jpeg6/bin
mkdir/usr/local/jpeg6/lib
mkdir/usr/local/jpeg6/include
mkdir -p /usr/local/jpeg6/man/man1
cd /lamp/jpeg-6b
cp /usr/share/libtool/config/config.sub .
cp /usr/share/libtool/config/config.guess
#復(fù)制libtool中的文件,覆蓋jpeg-6b中的文件(64位中的問(wèn)題,32位沒(méi)有此報(bào)錯(cuò))
cd /lamp/jpeg-6b
./configure--prefix=/usr/local/jpeg6/ --enable-shared --enable-static
make &&make install
2.9、 # 安裝freetype
cd/lamp/freetype-2.3.5
./configure--prefix=/usr/local/freetype/ && make && make install
2.10、# 安裝ncurses
yum -y install ncurses-devel
注:如果報(bào)錯(cuò),包找不到,是*通配符沒(méi)有識(shí)別,給文件名加雙引號(hào) “ncurses*”
cd/lamp/ncurses-5.9
./configure--with-shared --without-debug --without-ada --enable-overwrite
make && make install
2、重量級(jí)源碼包
2.11、# 安裝Apache
configure: error: BundledAPR requested but not found at ./srclib/.Download and unpack the corresponding apr and apr-util packages to ./srclib/.
#如果報(bào)錯(cuò),則:
tar zxvf apr-1.4.6.tar.gz
tar zxvf apr-util-1.4.1.tar.gz 解壓過(guò)
cp -r /lamp/apr-1.4.6 /lamp/httpd-2.4.7/srclib/apr
cp -r /lamp/apr-util-1.4.1 /lamp/httpd-2.4.7/srclib/apr-util
#解壓apr和apr-util,復(fù)制并取消版本號(hào)
configure: error:pcre-config for libpcre not found. PCRE isrequired and available from
#如果報(bào)錯(cuò),則:
tar zxvf pcre-8.34.tar.gz
cd /lamp/pcre-8.34
./configure && make&& make install
checking whether to enablemod_ssl... configure: error: mod_ssl has been requested but can not be builtdue to prerequisite failures
#如果報(bào)錯(cuò),則:
yum install openssl-devel
安裝apache
cd /lamp/httpd-2.4.7
./configure --prefix=/usr/local/apache2/ \
--sysconfdir=/usr/local/apache2/etc/ \
--with-included-apr--enable-so --enable-deflate=shared \
--enable-expires=shared--enable-rewrite=shared
make
make install
*若前面配置zlib時(shí)沒(méi)有指定安裝目錄,Apache配置時(shí)不要添加--with-z=/usr/local/zlib/參數(shù)
啟動(dòng)Apache測(cè)試:
/usr/local/apache2/bin/apachectlstart
ps aux| grep httpd
netstat –antp | grep :80
可以使用腳本將apache像httpd一樣啟動(dòng)
cat apache.sh
#!/bin/bash
#chkconfig管理apache服務(wù)
#chkconfig:- 82 15
#discription:
path=/usr/local/apache2/bin/apachectl
case $1 in
start)
$path start
;;
stop)
$path stop
;;
restart)
$path stop
sleep 3s
$path start
;;
configtest)
$path -t
;;
*)
echo"pleas input start |stop | restart |configtest ."
;;
esac
mv apache.sh /etc/init.d/httpd
chmod 755 httpd
service httpd start
*若啟動(dòng)時(shí)提示/usr/local/apache2/modules/mod_deflate.so無(wú)權(quán)限,可關(guān)閉SELinux或者執(zhí)行命令chcon -t texrel_shlib_t/usr/local/apache2/modules/mod_deflate.so ,類(lèi)似此類(lèi).so文件不能載入或沒(méi)有權(quán)限的問(wèn)題,都是SELinux問(wèn)題,使用命令:“chcon -t texrel_shlib_t 文件名”即可解決,MySQL和Apache也可能有類(lèi)似問(wèn)題。
通過(guò)瀏覽器輸入地址訪問(wèn):http://Apache服務(wù)器地址,若顯示“It works”即表明Apache正常工作
設(shè)置Apache系統(tǒng)引導(dǎo)時(shí)啟動(dòng):開(kāi)機(jī)自啟動(dòng)
echo "/usr/local/apache2/bin/apachectlstart" >> /etc/rc.d/rc.local
注:安裝完成后,先啟動(dòng)apache進(jìn)行服務(wù)驗(yàn)證,是否安裝成功,并且主頁(yè)是否可以訪問(wèn)。
注:發(fā)現(xiàn)啟動(dòng)服務(wù)報(bào)錯(cuò):AH00558: httpd: Could not reliably determine the server's fullyqualified domain name, using localhost.localdomain. Set the 'ServerName' directiveglobally to suppress this message
解決辦法:打開(kāi)主配置文件 /usr/local/apache/etc/httpd.conf
搜索ServerName (約在200行左右)
修改為 ServerName localhost:80(并且去掉前面的#注釋?zhuān)?/p>
2.12、# 安裝MySQL
useradd -r -s /sbin/nologin mysql
mkdir /usr/lo cal/mysql -p
*創(chuàng)建系統(tǒng)用戶mysql
cd /lamp/mysql-5.5.48
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql 安裝位置
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock 指定socket(套接字)文件位置
-DEXTRA_CHARSETS=all 擴(kuò)展字符支持
-DDEFAULT_CHARSET=utf8 默認(rèn)字符集
-DDEFAULT_COLLATION=utf8_general_ci 默認(rèn)字符校對(duì)
-DWITH_MYISAM_STORAGE_ENGINE=1 安裝myisam存儲(chǔ)引擎
-DWITH_INNOBASE_STORAGE_ENGINE=1 安裝innodb存儲(chǔ)引擎
-DWITH_MEMORY_STORAGE_ENGINE=1 安裝memory存儲(chǔ)引擎
-DWITH_READLINE=1 支持readline庫(kù)
-DENABLED_LOCAL_INFILE=1 啟用加載本地?cái)?shù)據(jù)
-DMYSQL_USER=mysql 指定mysql運(yùn)行用戶
-DMYSQL_TCP_PORT=3306 指定mysql端口
make
make install
makeclean
rmCMakeCache.txt
#如果報(bào)錯(cuò),清除緩存,請(qǐng)使用以上命令
cd/usr/local/mysql/
chown -R root .
chown -R mysql data
#修改mysql目錄權(quán)限
cp support-files/my-medium.cnf /etc/my.cnf
#復(fù)制mysql配置文件
/usr/local/mysql/scripts/mysql_install_db --user=mysql
#創(chuàng)建數(shù)據(jù)庫(kù)授權(quán)表,初始化數(shù)據(jù)庫(kù)
啟動(dòng)MySQL服務(wù):
1.用原本源代碼的方式去使用和啟動(dòng)mysql
/usr/local/mysql/bin/mysqld_safe --user=mysql &
2.重啟以后還要生效:
vim /etc/rc.local
/usr/local/mysql/bin/mysqld_safe --user=mysql &
3.設(shè)定mysql密碼
/usr/local/mysql/bin/mysqladmin -urootpassword 123456
清空歷史命令 history -c
*給mysql用戶root加密碼123
* 注意密碼不能寫(xiě)成太簡(jiǎn)單,做實(shí)驗(yàn)隨便
/usr/local/mysql/bin/mysql -u root -p
mysql>show databases;
mysql>use test;
mysql>show tables;
mysql>\s #查看字符集是否改為utf8
*進(jìn)入mysql以后用set來(lái)改密碼
mysql> exit
*登錄MySQL客戶端控制臺(tái)設(shè)置指定root密碼
2.13、# 安裝PHP
編譯前確保系統(tǒng)已經(jīng)安裝了libtool和libtool-ltdl軟件包,安裝:
yum -yinstall "libtool*"
mkdir/usr/local/php/etc/ -p
cd/lamp/php-7.0.7
./configure--prefix=/usr/local/php/ --with-config-file-path=/usr/local/php/etc/--with-apxs2=/usr/local/apache2/bin/apxs --with-libxml-dir=/usr/local/libxml2/ --with-jpeg-dir=/usr/local/jpeg6/--with-png-dir=/usr/local/libpng/ --with-freetype-dir=/usr/local/freetype/--with-mcrypt=/usr/local/libmcrypt/ --with-mysqli=/usr/local/mysql/bin/mysql_config--enable-soap --enable-mbstring=all --enable-sockets --with-pdo-mysql=/usr/local/mysql--with-gd --without-pear
l 若前面配置zlib時(shí)沒(méi)有指定安裝目錄,PHP配置時(shí)不要添加--with-zlib-dir=/usr/local/zlib/參數(shù)
選項(xiàng):
--with-config-file-path=/usr/local/php/etc/ 指定配置文件目錄
--with-apxs2=/usr/local/apache2/bin/apxs 指定apache動(dòng)態(tài)模塊位置
--with-libxml-dir=/usr/local/libxml2/ 指定libxml位置
--with-jpeg-dir=/usr/local/jpeg6/ 指定jpeg位置
--with-png-dir=/usr/local/libpng/ 指定libpng位置
--with-freetype-dir=/usr/local/freetype/ 指定freetype位置
--with-mcrypt=/usr/local/libmcrypt/ 指定libmcrypt位置
--with-mysqli=/usr/local/mysql/bin/mysql_config 指定mysqli位置
--with-gd 啟用gd庫(kù)
--enable-soap 支持soap服務(wù)
--enable-mbstring=all 支持多字節(jié),字符串
--enable-sockets 支持套接字
--with-pdo-mysql=/usr/local/mysql 啟用mysql的pdo模塊支持
--without-pear 不安裝pear(安裝pear需要連接互聯(lián)網(wǎng)。
make
make install
生成php.ini
cp /lamp/php-7.0.7/php.ini-production /usr/local/php/etc/php.ini
測(cè)試Apache與PHP的連通性,看Apache是否能解析php文件
vim /usr/local/apache2/etc/httpd.conf
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
(注意大小寫(xiě))
* .phtml為將.phps做為PHP源文件進(jìn)行語(yǔ)法高亮顯示
重啟Apache服務(wù):/usr/local/apache2/bin/apachectl stop
/usr/local/apache2/bin/apachectl start
* Apache無(wú)法啟動(dòng),提示cannot restore segmentprot after reloc: Permission denied錯(cuò)誤,為SELinux問(wèn)題,可關(guān)閉SELinux或者執(zhí)行命令chcon -ttexrel_shlib_t /usr/local/apache2/modules/libphp5.so
測(cè)試:vim /usr/local/apache2/htdocs/test.php
<?php
phpinfo();
?>
通過(guò)瀏覽器輸入地址訪問(wèn):http://Apache服務(wù)器地址/test.php
Rpm包安裝的網(wǎng)頁(yè)默認(rèn)目錄 /var/www/html/
*有時(shí)第一次瀏覽器測(cè)試會(huì)失敗,關(guān)閉瀏覽器重啟再?lài)L試即可,非編譯錯(cuò)誤
2.14、#安裝openssl
OpenSSL是一個(gè)強(qiáng)大的安全套接字層密碼庫(kù),囊括主要的密碼算法、常用的密鑰和證書(shū)封裝管理功能及SSL協(xié)議,并提供豐富的應(yīng)用程序供測(cè)試或其它目的使用。
yum-y install openssl-devel 必須安裝
cd/lamp/php-7.0.7/ext/openssl
mvconfig0.m4 config.m4 否則報(bào)錯(cuò):找不到config.m4
PATH=$PATH:/usr/local/php/bin/(臨時(shí)) vi /etc/profile
cd/lamp/php-7.0.7/
./configure--with-openssl --with-php-config=/usr/local/php/bin/php-config
make
makeinstall
2.15、# 編譯安裝pecl
Memcache是一個(gè)高性能的分布式的內(nèi)存對(duì)象緩存系統(tǒng),通過(guò)在內(nèi)存里維護(hù)一個(gè)統(tǒng)一的巨大的hash表,它能夠用來(lái)存儲(chǔ)各種格式的數(shù)據(jù),包括圖像、視頻、文件以及數(shù)據(jù)庫(kù)檢索的結(jié)果等。簡(jiǎn)單的說(shuō)就是將數(shù)據(jù)調(diào)用到內(nèi)存中,然后從內(nèi)存中讀取,從而大大提高讀取速度。
https://github.com/websupport-sk/pecl-memcache/archive/php7.zip
unzip pecl-memcache-php7.zip
cd pecl-memcache-php7
/usr/local/php/bin/phpize 這是一個(gè)命令 ,用于生成一個(gè)配置目錄
./configure--with-php-config=/usr/local/php/bin/php-config
make && make install
修改/usr/local/php/etc/php.ini
extension_dir ="/usr/local/php/lib/php/extensions/no-debug-zts-20151012/"
#打開(kāi)注釋?zhuān)⑿薷?/p>
extension="openssl.so";
extension="memcache.so";
修改位置
#添加
#重啟apache,在phpinfo中可以找到這個(gè)模塊
2.16、#安裝memcache源代碼
首先安裝依賴(lài)包libevent
yum -yinstall libevent-devel
#在CentOS 6.3第二張光盤(pán)中,請(qǐng)換盤(pán)
umount/mnt/cdrom
#放入CentOS 6.3第二張光盤(pán)
#mount/dev/sr0 /mnt/cdrom
mkdir /usr/local/memcache
cd/lamp/memcached-1.4.17
./configure--prefix=/usr/local/memcache
make && makeinstall
useradd memcache
#添加memcache用戶,此用戶不用登錄,不設(shè)置密碼
/usr/local/memcache/bin/memcached-umemcache &
netstat -an | grep:11211
寫(xiě)入自啟動(dòng):
vi/etc/rc.d/rc.local
/usr/local/memcache/bin/memcached-umemcache &
第三步、項(xiàng)目遷移
1、把php項(xiàng)目拷貝到網(wǎng)站默認(rèn)目錄下: /usr/local/apache2/htdocs/
2、手工建立數(shù)據(jù)庫(kù)表結(jié)構(gòu)
第四步、安裝phpMyAdmin (給php管理添加用戶)
cp -r /lamp/phpMyAdmin-4.1.4-all-languages/usr/local/apache2/htdocs/phpmyadmin
cd/usr/local/apache2/htdocs/phpmyadmin
cpconfig.sample.inc.php config.inc.php
vim config.inc.php
$cfg['Servers'][$i]['auth_type']= 'cookie';
$cfg['Servers'][$i]['auth_type']= 'http';
以上兩行都有
*設(shè)置auth_type為http ,即設(shè)置為HTTP身份認(rèn)證模式
通過(guò)瀏覽器輸入地址訪問(wèn):http://Apache服務(wù)器地址/phpmyadmin/index.php
用戶名為root ,密碼為MySQL設(shè)置時(shí)指定的root密碼123456(lampbrother)
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性?xún)r(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專(zhuān)為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。
當(dāng)前名稱(chēng):源碼包搭建LAMP環(huán)境-創(chuàng)新互聯(lián)
當(dāng)前路徑:http://aaarwkj.com/article30/cogepo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供面包屑導(dǎo)航、網(wǎng)站設(shè)計(jì)公司、移動(dòng)網(wǎng)站建設(shè)、電子商務(wù)、搜索引擎優(yōu)化、Google
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容
營(yíng)銷(xiāo)型網(wǎng)站建設(shè)知識(shí)