佳木斯湛栽影视文化发展公司

主頁 > 知識(shí)庫 > freebsd9.1源碼安裝apache、mysql、php環(huán)境(親側(cè)通過)

freebsd9.1源碼安裝apache、mysql、php環(huán)境(親側(cè)通過)

熱門標(biāo)簽:集時(shí)通訊 IT外包 呼叫中心解決方案 檢查注冊(cè)表項(xiàng) 免費(fèi)建站 呼叫外包 美團(tuán) 蘋果

新手不建議用源碼安裝,請(qǐng)慎重

1.安裝9.1系統(tǒng)

2.通過Sysinstall安裝預(yù)裝軟件

=========================================================

3.安裝Linux_libio兼容包

rc.conf 增加一句linux_enable=true 應(yīng)該是 linux_enable="YES"

========================================================

4.通過ports安裝SSH守護(hù)進(jìn)程(ports/security/sshgard)

5.通過Ports安裝加密相關(guān)的軟件(ports/security/mcrypt)

6.安裝MYSQL

7.安裝apr(/configure   ,make install clean)

8.安裝apr-util1.5.1(/configure --with-apr=/usr/local/apr)

9.安裝Apache

10. 安裝PHP

11.安裝FastCGI

12.安裝Xcache

13.安裝Memcache

15.安裝Proftpd

 

Freebsd支持中文.txt

設(shè)置全局的 locale 參考下面方法:

vi /etc/login.conf

最后增加這個(gè):

chinese:Chinese Users Accounts:\

:charset=UTF-8:\

:lang=zh_CN.UTF-8:\

:tc=default:

然后修改你的passwd文件,使用vipw命令

user:password:1111:11:language:0:0:User Name:/home/user:/bin/sh

language位置寫入chinese,關(guān)聯(lián)上你的locale。

export LC_CTYPE="zh_CN.UTF-8"

export LC_ALL="zh_CN.UTF-8"

export LANG="zh_CN.UTF-8"

需要更新一下數(shù)據(jù)庫,使用 cap_mkdb /etc/login.conf

登出再登錄,使用命令 locale 就可以看到你的 locale 已經(jīng)修改完成了

php需要環(huán)境.txt

1.curl,gd,mbstring,jpeg,png,php_memcache,xcache,mysql,apache

安裝時(shí)都需要指定安裝目錄

Robin_預(yù)裝包.txt

通過Sysinstall安裝(光盤)

1.archives:libzip;zip;unzip

2.databases: sqlite

3.converters: libiconv(php用于編碼轉(zhuǎn)換)

4.devel: pre-8.20l(Apache);perl-5.12.4.3

5.emulators: linux_base兼容包

6.FTP: curl-1.21.3.2

7.graphics: giflib-4.1.6 ; jpeg-8.3 ; libexif-0.6.20 ; png-1.4.8

8.lang: perl-5.12.4.3 ; python ; ruby

9.all:  libxml2-7.8-1 , freetype

ports/emulators/linux_libauo

ports/security/sshguard

ports/security/mcrypt

 kldstat 命令內(nèi)核掛載情況,是否關(guān)在linux.ko

開始安裝

1、安裝mysql 

 

創(chuàng)建用戶組mysql

shell>pw groupadd mysql

添加用戶至用戶組

shell> pw useradd -r -g mysql mysql

解壓:因?yàn)閙ysql是已經(jīng)編譯好的版本,因此無需安裝

cd /soft 

tar –vzxf mysql-5.6.11.tar.gz  解壓

mv mysql-5.6.11-free* /usr/local/servers/mysql

cd  /usr/local/shadow/mysql

chown –R mysql .  更改當(dāng)前文件夾下所有文件的用戶(注意后面有.)

chgrp –R mysql .  更改當(dāng)前文件夾下所有文件的組

./scripts/mysql_install_db –user=mysql  安裝mysql服務(wù),會(huì)生成一個(gè)my.cnf的配置文件

chown –R root .   修改mysql文件夾內(nèi)所有文件用戶為root

chown –R mysql data修改mysql文件夾內(nèi)data文件夾用戶為mysql

./bin/mysqld_safe –user=mysql   啟動(dòng)mysql服務(wù)

./bin/mysql –u root –p 密碼為空

use mysql

Delete from user where host>’127.0.0.1’;

select host,user,password from user;

update user set host=’%’,password=password(‘shadow’); //修改登錄ip為任意;密碼為shadow

flush privileges;   //刷新mysql帳號(hào)權(quán)限

然后遠(yuǎn)程連一下數(shù)據(jù)庫試試吧。。

  初始化root密碼

bin/mysqladmin -u root password 'newpassword'

bin/mysqladmin –u root password  123456

./mysqladmin   -u   root   -p   password   '456'  

 然后系統(tǒng)會(huì)詢問你現(xiàn)在的密碼,你輸入現(xiàn)在的密碼123回車就可以了  

 下次使用MYSQL的時(shí)候,ROOT   的口令就是456了

 測(cè)試帳號(hào)

bin/mysql –u root –p

然后輸入密碼,出現(xiàn)提示符:

mysql>

技巧提示:

mysql #運(yùn)行mysql 客戶端,并開放root用戶的遠(yuǎn)程訪問權(quán)限。以便調(diào)試

use mysql

update user set host = '%' where user = 'root' and host > 'localhost';

flush privileges;

quit

2、apache安裝

Step 1

編譯Apache的要求

1.  磁盤空間   2.ANSI- C編譯器及編譯環(huán)境 3.確保準(zhǔn)確的時(shí)間 4.Perl5 [可選]

5.  apr/apr-util >= 1.2

需要先下載  apr-1.4.6.tar.gz 和 apr-util-1.5.1.tar.gz

配置并安裝  地址  http://apr.apache.org/download.cgi

apr和apr-util包含在Apache httpd的發(fā)行源代碼中,并且在絕大多數(shù)情況下使用都不會(huì)出現(xiàn)問題。

當(dāng)然,如果apr或apr-util的1.0或1.1版本已經(jīng)安裝在你的系統(tǒng)中了,則必須將你的apr/apr-util升級(jí)到1.2版本,

或者將httpd單獨(dú)分開編譯。要使用發(fā)行源代碼中自帶的apr/apr-util源代碼進(jìn)行安裝,你必須手動(dòng)完成:

@note: 編譯和安裝 apr 1.4.6

tar -zxvf apr-1.4.6.tar.gz

cd srclib/apr-1.4.6

./configure –-prefix=/usr/local/apr/

make

make install

@note: 編譯和安裝 apr-util 1.5.1

tar -zxvf apr-util1.5.1.tar.gz

cd ../apr-util1.5.1

./configure –-prefix=/usr/local/apr-util/ –-with-apr=/usr/local/apr/

make

make install

step2-1安裝httpd

tar zxvf httpd-2.2.15.tar.gz

cd ../httpd-2.2.15

安裝示例: ./configure --prefix=/usr/local/servers/apache22 --enable-so      --enable-deflate=shared --enable-ssl=shared --enable-expires=shared        --enable-headers=shared --enable-rewrite=shared --enable-static-support      --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr-util/bin/apu-1-config --with-mpm=prefork --enable-cache=shared --enable-disk-cache=shared --enable-mem-cache=shared --enable-vhost-alias=shared --enable-suexec --with-pcre

make

make install

apache 啟動(dòng)服務(wù)

    /usr/local/servers/apache22/bin/httpd -k start restart stop

    /usr/local/servers/apache22/bin/httpd -k graceful

    /usr/local/apache/bin/apachectl -k restart

3、安裝php

    版本要求,至少5.4以上

    安裝apache需要vhost支持

    可以平滑重啟

1.安裝mod_fastcgi

    下載mod_fastcgi-2.4.6

    解壓縮

    修改Makefile.AP2改名為Makefile

修改   top_dir=你的apache路徑

    然后執(zhí)行命令make install 安裝  

2.phpcgi 服務(wù)啟動(dòng) 即安裝php 需要php5.4以上

    /usr/local/servers/php/sbin/php-fpm

    安裝示例: ./configure --prefix=/usr/local/php --with-apxs2=apache路徑/bin/apxs2

--enable-fpm --with-zlib=/zlib路徑 --with-bz2=/bzip2路徑 --with-curl=/curl路徑 --with-gd=/gd路徑

--with-jpeg-dir=/jpeg路徑 --with-png-dir=/png路徑 --enable-mbstring --with-mcrypt=/mcrypt路徑

--with-mysql=/mysql路徑 --with-mysqli=/mysql路徑 --with-libxml-dir=/xml路徑 --enable-mysqlnd

    我是這樣進(jìn)行安裝配置的

    ./configure --prefix=/usr/local/servers/php --with-apxs2=/usr/local/servers/apache22/bin/apxs --enable-fpm --with-zlib --with-bz2 --with-curl --with-gd --enable-gd-jis-conv --with-freetype-dir --with-jpeg-dir --with-png-dir --enable-mbstring --enable-ftp --enable-exif --with-mcrypt --with-mysql --with-mysqli=mysqlnd --with-libxml-dir --enable-mysqlnd

完成上面會(huì)顯示感謝使用PHP等字樣

make

編譯成功后出現(xiàn)"Build complete."字樣,那么就可以進(jìn)行安裝了:

(make編譯時(shí)fpm模塊出錯(cuò):解決辦法php5.4.11/sapi/fpm/fpm/fpm_sockets.c文件修改三處代碼     info.tcpi_sacked  改為: info.__tcpi_sacked

info.tcpi_unacked 改為: info.__tcpi_unacked)

make install

 完成即可  可以平滑重啟

 3、拷貝php配置文件

cp  php.ini-development(開發(fā)模式)  或者production生產(chǎn)模式     /usr/local/servers/php/etc/php.ini

修改php.ini

    disable_functions =system,exec,shell_exec,passthru,ini_alter,dl,pfsockopen,openlog,syslog,readlink,symlink,link,

leak,popen,escapeshellcmd,apache_child_terminate,apache_get_modules,apache_get_version,

apache_getenv,apache_note,apache_setenv,virtual;,phpinfo

4、修改配置

修改/usr/local/servers/php/etc/php.ini文件(新版本可能不需要)

register_globals = On

修改/usr/local/apache/conf/ httpd.conf文件

設(shè)置apache的默認(rèn)文件名次序

DirectoryIndex index.html index.htm index.php

增加php后綴支持

AddType application/x-httpd-php .php .php3 .phtml

AddType application/x-httpd-php-source .phps

5、重啟apache服務(wù)

/usr/local/apache/bin/apachectl -k restart

6、測(cè)試php

?php

echo phpinfo();

?>

4、proftp 服務(wù)安裝啟動(dòng),安裝ftp

    /usr/local/servers/proftp/sbin/proftpd

    安裝示例:./configure --prefix=/usr/local/servers/proftpd

    添加、修改、刪除帳號(hào)

首先添加管理組     

./ftpasswd --group --name=czh --gid=1001 --file=../etc/group   

添加用戶

./ftpasswd --passwd --name=sohuishangbao --uid=1004 --gid=80 --file=../etc/passwd

--shell=/sbin/nologin --home=/wwwroot/lianmeng

./ftpasswd --passwd --name=hsbczh --uid=1003 --gid=1001 --file=../etc/passwd

--shell=/sbin/nologin --home=/wwwroot/www.huishangbao.com/www

輸入后,會(huì)提示輸入用戶的密碼,密碼不能太長(zhǎng),不能有特殊字符。   

注意,以上路徑需根據(jù)各服務(wù)具體路徑而定

www1:*:1003:80:User :/home/www1:/usr/sbin/nologin

www2:*:1004:80:User :/home/www2:/usr/sbin/nologin

www3:*:1005:80:User :/home/www3:/usr/sbin/nologin

www4:*:1006:80:User :/home/www4:/usr/sbin/nologin

www5:*:1007:80:User :/home/www5:/usr/sbin/nologin

www6:*:1008:80:User :/home/www6:/usr/sbin/nologin

www7:*:1009:80:User :/home/www7:/usr/sbin/nologin

www8:*:1010:80:User :/home/www8:/usr/sbin/nologin

www9:*:1011:80:User :/home/www9:/usr/sbin/nologin

標(biāo)簽:眉山 安康 韶關(guān) 泰州 營(yíng)口 信陽 邢臺(tái) 宿遷

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《freebsd9.1源碼安裝apache、mysql、php環(huán)境(親側(cè)通過)》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    江永县| 漠河县| 仁怀市| 南陵县| 资溪县| 柳州市| 永和县| 台东县| 东明县| 政和县| 建水县| 资源县| 巧家县| 绥滨县| 大理市| 华安县| 三明市| 周至县| 邵武市| 柞水县| 太白县| 乃东县| 工布江达县| 分宜县| 原阳县| 应城市| 大同县| 乃东县| 漳浦县| 乐亭县| 吉隆县| 漯河市| 西吉县| 北流市| 土默特左旗| 崇礼县| 淄博市| 革吉县| 镇坪县| 长治县| 宽甸|