亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

linux單機LAMP環境搭建

發布時間:2020-07-18 00:47:07 來源:網絡 閱讀:383 作者:sam_jian 欄目:數據庫

LAMP單機環境搭建

一.系統環境準備。

1.系統環境:CentOS_6.5,32位

[root@localhost ~]# cat /etc/redhat-release      

CentOS release 6.5 (Final)

[root@localhost ~]# uname -r

2.6.32-431.el6.i686

2.軟件版本

httpd-2.2.31

mysql-5.1.72

php-5.5.32

3.關閉防火墻iptables和selinux

3.1關閉防火墻iptables

[root@localhost tools]# chkconfig --level 2345iptables off

[root@localhost tools]# chkconfig --listiptables

iptables       0:off   1:off   2:off  3:off   4:off   5:off  6:off

[root@localhost tools]# service iptables stop

[root@localhost tools]# service iptablesstatus

iptables: Firewall is not running.

3.2關閉selinux

[root@localhost tools]# vim/etc/selinux/config        #修改配置如下圖所示

linux單機LAMP環境搭建

4.新建軟件管理文件夾及上傳相關軟件

4.1創建軟件管理文件夾

[root@localhost tools]# mkdir -p/home/jeff/tools/

[root@localhost tools]# ll /home/jeff/

total 4

drwxr-xr-x. 5 root root 4096 May 16 10:16tools

4.2上傳相關軟件

[root@localhost /]# cd /home/jeff/tools/

利用rz命令上傳相關軟件。如果無法使用該命令,請安裝lrzsz軟件。

二.安裝相關軟件

1.安裝apache軟件

1.1解壓apache

root@localhost tools]# tar -zxvf httpd-2.2.31.tar.gz

[root@localhost tools]# ll

total 63248

-rw-r--r-- 1 root root 10364427 Feb 22 14:51 Discuz_X3.1_SC_GBK.zip

drwxr-xr-x 11 1000 1000     4096 Jul 16  2015 httpd-2.2.31

-rw-r--r--  1 root root 7583841 May 16 10:11 httpd-2.2.31.tar.gz

-rw-r--r-- 1 root root  4984397 Feb 22 13:52libiconv-1.14.tar.gz

-rw-r--r-- 1 root root 24044338 Feb 22 10:47 mysql-5.1.72.tar.gz

-rw-r--r-- 1 root root 17773092 Feb 22 11:22 php-5.5.32.tar.gz

1.2進入apache軟件目錄并進行配置(安裝請先安裝apr、apr-util、prce、gcc gcc-c++

[root@localhost tools]# cd httpd-2.2.31

[root@localhost httpd-2.2.31]#./configure \

--prefix=/usr/local/apache2.2.31 \

--with-apr=/usr/local/apr \

--with-apr-util=/usr/local/apr-util \

--with-pcre=/usr/local/pcre \

--enable-deflate \

--enable-expires \

--enable-headers \

--enable-modules=most \

--enable-so \

--with-mpm=worker \

--enable-rewrite

1.3編譯安裝

[root@localhost httpd-2.2.31]# make & makeinstall

1.4啟動及檢查apache安裝情況

1.4.1啟動apache

[root@localhost bin]# ./apachectl start       #啟動apache

httpd: Could not reliably determine theserver's fully qualified domain name, using ::1 for ServerName

1.4.2檢查apache啟動情況

[root@localhost bin]# ps -ef | grep http*      #查看apache進程

root    17464     1  0 11:45 ?        00:00:00/usr/local/apache2.2.31/bin/httpd -k start

daemon  17465 17464  0 11:45 ?        00:00:00/usr/local/apache2.2.31/bin/httpd -k start

daemon  17466 17464  0 11:45 ?        00:00:00/usr/local/apache2.2.31/bin/httpd -k start

daemon  17467 17464  0 11:45 ?        00:00:00/usr/local/apache2.2.31/bin/httpd -k start

daemon  17468 17464  0 11:45 ?        00:00:00 /usr/local/apache2.2.31/bin/httpd-k start

root    17552  3284  0 11:45 pts/1    00:00:00 grep httpd

[root@localhost bin]# netstat -lntp | grep 80    #查看apache監聽端口

tcp       0      0 :::80                       :::*                        LISTEN      17464/httpd

用瀏覽器檢查:

http://localhost,如出現如下頁面,則說明apache安裝成功。

linux單機LAMP環境搭建

2.安裝mysql軟件

2.1解壓mysql

[root@localhost tools]# tar -zxvfmysql-5.1.72.tar.gz

[root@localhost tools]# ll

total 67372

drwxr-xr-x 12 1000  1000    4096 May 16 11:42 httpd-2.2.31

-rw-r--r-- 1 root root   7583841 May 16 10:11httpd-2.2.31.tar.gz

drwxrwxrwx 32 7155 wheel     4096 Sep 10  2013 mysql-5.1.72

-rw-r--r-- 1 root root  24044338 Feb 22 10:47mysql-5.1.72.tar.gz

-rw-r--r-- 1 root root  17773092 Feb 22 11:22php-5.5.32.tar.gz

2.2建立mysql相應的用戶的用戶組

[root@localhost mysql-5.1.72]# groupadd -g 800mysql          #創建mysql用戶組

[root@localhost mysql-5.1.72]# useradd -gmysql -u 800 -M -s /sbin/nologin mysql       #創建mysql用戶

[root@localhost mysql-5.1.72]# cat /etc/group| grep mysql       #檢查mysql組創建情況

mysql:x:800:

[root@localhost mysql-5.1.72]# cat /etc/passwd| grep mysql     #檢查mysql用戶創建情況

mysql:x:800:800::/home/mysql:/sbin/nologin

#-s /sbin/nologin表示禁止該用戶登錄,加強安全。

#-g mysql指定屬于mysql組。

#-M表示不創建用戶家目錄。

2.3進入mysql軟件目錄并進行編譯安裝

2.3.1進入mysql軟件目錄

[root@localhost tools]# cd mysql-5.1.72                #進入mysql安裝目錄

2.3.2配置mysql(配置前安裝ncurses-devel先)

[root@localhost mysql-5.1.72]#./configure \

--prefix=/usr/local/mysql5.1.72 \

--with-unix-socket-path=/usr/local/mysql5.1.72/tmp/mysql.sock\

--localstatedir=/usr/local/mysql5.1.72/data \

--enable-assembler \

--enable-thread-safe-client \

--with-mysqld-user=mysql \

--with-big-tables \

--without-debug \

--with-pthread \

--enable-assembler \

--with-extra-charsets=complex \

--with-readline \

--with-ssl \

--with-embedded-server \

--enable-local-infile \

--with-plugins=partition,innobase \

--with-plugin-PLUGIN \

--with-mysqld-ldflags=-all-static \

--with-client-ldflags=-all-static

2.3.3編譯安裝

[root@localhost mysql-5.1.72] #make & makeinstall

2.4獲取mysql配置文件

[root@localhost mysql-5.1.72]# cdsupport-files

[root@localhost support-files]# cp -amy-small.cnf /etc/my.cnf

2.5創建軟連接,方便維護及升級

[root@localhost local]# ln -s /usr/local/mysql5.1.72//usr/local/mysql

2.6創建mysql數據庫文件

[root@localhost local]# mkdir -p/usr/local/mysql/data          #建立mysql數據文件目錄

[root@localhost local]# chown -R mysql:mysql/usr/local/mysql5.1.72 #授權mysql用戶訪問mysql的安裝目錄

[root@localhost local]#/usr/local/mysql/bin/mysql_install_db --user=mysql  #安裝mysql數據庫文件

2.7啟動mysql數據庫

[root@localhost bin]# cp /home/jeff/tools/mysql-5.1.72/support-files/mysql.server/usr/local/mysql/bin/

#拷貝mysql啟動腳本到mysql的命令路徑

[root@localhost bin]# chmod 700/usr/local/mysql/bin/mysql.server     #使腳本可執行

[root@localhost bin]#/usr/local/mysql/bin/mysql.server start         #啟動數據庫

Starting MySQL. SUCCESS!

2.8檢查mysql數據庫啟動情況

[root@localhost bin]# netstat -lnt | grep 3306          #檢查mysql監聽端口

tcp       0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN 

[root@localhost bin]# ps -ef | grep"mysql*"            #檢查mysql進程

root     3085     1  0 14:43 pts/3    00:00:00 /bin/sh/usr/local/mysql5.1.72/bin/mysqld_safe --datadir=/usr/local/mysql5.1.72/data--pid-file=/usr/local/mysql5.1.72/data/localhost.pid

mysql    3200  3085  0 14:43 pts/3    00:00:00 /usr/local/mysql5.1.72/libexec/mysqld--basedir=/usr/local/mysql5.1.72 --datadir=/usr/local/mysql5.1.72/data--user=mysql --log-error=/usr/local/mysql5.1.72/data/localhost.err--pid-file=/usr/local/mysql5.1.72/data/localhost.pid --socket=/usr/local/mysql5.1.72/tmp/mysql.sock--port=3306

root     3239 18040  0 14:47 pts/3    00:00:00 grep mysql*

[root@localhost bin]#/usr/local/mysql/bin/mysql -uroot          #進入mysql

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.1.72 Source distribution

Copyright (c) 2000, 2013, Oracle and/or itsaffiliates. All rights reserved.

Oracle is a registered trademark of OracleCorporation and/or its

affiliates. Other names may be trademarks oftheir respective

owners.

Type 'help;' or '\h' for help. Type '\c' toclear the current input statement.

mysql>

2.9配置mysql命令的全局路徑

[root@localhost bin]# echo 'exportPATH=$PATH:/usr/local/mysql/bin' >> /etc/profile  

[root@localhost bin]# tail -1 /etc/profile            #檢查

export PATH=$PATH:/usr/local/mysql/bin

source /etc/profile    #使生效

2.10配置/etc/init.d/mysqldstart 方式啟動數據庫

[root@localhost bin]# cp/usr/local/mysql/bin/mysql.server /etc/init.d/mysqld      

#拷貝mysql啟動腳本到/etc/init.d/

chmod 700 /etc/init.d/mysqld       #授權700權限,即腳本可執行

[root@localhost bin]# /etc/init.d/mysqld start 

Starting MySQL. SUCCESS!

2.11設置開機自啟動

[root@localhost bin]# chkconfig --add mysqld

[root@localhost bin]# chkconfig mysqld on

[root@localhost bin]# chkconfig --list mysqld

mysqld         0:off   1:off   2:on   3:on    4:on    5:on   6:off

2.12 mysql安全配置,設置登錄密碼

[root@localhost bin]# mysqladmin -urootpassword '123456'    #設置密碼:123456

3.安裝PHP軟件

3.1檢查安裝PHP所需lib庫

[root@localhost tools]# rpm -qa zlib libxmllibjpeg freetype libpng gd curl libiconv zlib-devel libxml2-devel libjpeg-develfreetype-devel libpng-devel gd-devel curl-devel     #檢查lib庫安裝情況

安裝所需lib庫

[root@localhost tools]# yum install zliblibxml libjpeg freetype libpng gd curl libiconv zlib-devel libxml2-devellibjpeg-devel freetype-devel libpng-devel gd-devel curl-devel –y

安裝libiconv庫

[root@localhost tools]# wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz

[root@localhost tools]# tar -zxvflibiconv-1.14.tar.gz

[root@localhost tools]#cd libiconv-1.14.tar.gz

[root@localhost libiconv-1.14]#./configure --prefix=/usr/local/libiconv

[root@localhost libiconv-1.14]#make

[root@localhost libiconv-1.14]#make install

3.2解壓php軟件

[root@localhost tools]# tar -zxvfphp-5.5.32.tar.gz

[root@localhost tools]# ll

total 67376

drwxr-xr-x 14 1001  1001    4096 Feb  2 21:36 php-5.5.32

-rw-r--r-- 1 root root  17773092 Feb 22 11:22php-5.5.32.tar.gz

3.3配置

./configure \

--prefix=/usr/local/php5.5.32 \

--with-apxs2=/usr/local/apache/bin/apxs \

--with-mysql=/usr/local/mysql \

--with-xmlrpc \

--with-openssl \

--with-zlib \

--with-freetype-dir \

--with-gd \

--with-jpeg-dir \

--with-png-dir \

--with-iconv=/usr/local/libiconv \

--enable-short-tags \

--enable-sockets \

--enable-soap \

--enable-mbstring \

--enable-static \

--enable-gd-native-ttf \

--with-curl \

--with-xsl \

--enable-ftp \

--with-libxml-dir

3.4編譯安裝

[root@localhost php-5.5.32]#make

Build complete.

Don't forget to run 'make test'.

[root@localhost php-5.5.32]#make install

3.5生成配置文件

[root@localhost php-5.5.32]# ls php.ini*

php.ini-development  php.ini-production

[root@localhost php-5.5.32]# ln -s/usr/local/php5.5.32 /usr/local/php

[root@localhost php-5.5.32]# cpphp.ini-production /usr/local/php/lib/php.ini

3.6配置apache支持php

3.6.1修改apache配置文件

執行如下命令編輯apache的主配置文件httpd.conf:

[root@localhost /]#  cd /usr/local/apache/conf

[root@localhost conf]# cp httpd.confhttpd.conf.20160516.bak

[root@localhost conf]# vim httpd.conf

#增加如下內容:

ServerName 127.0.0.1:80

轉到311行即#AddTypeapplication/x-gzip .tgz行的下一行加兩行對PHP的解析支持內容:

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

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

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

修改默認的首頁文件,本例中增加一個index.php:

DirectoryIndex index.php index.html

3.7檢查并啟動apache

檢查apache配置文件的語法

[root@localhost conf]#/usr/local/apache/bin/apachectl -t

Syntax OK

重啟apache服務

[root@localhost conf]#/usr/local/apache/bin/apachectl graceful

[root@localhost conf]# netstat -lntp | grep 80

tcp       0      0 :::80                       :::*                        LISTEN      8989/httpd 

#查看httpd服務的80端口是否開啟

3.8測試php環境

進入指定的默認站點目錄后,編輯index.php添加:

進入默認的apache站點目錄

[root@localhost conf]# cd/usr/local/apache/htdocs/

[root@localhost conf]#vimindex.php

<?php

Phpinfo();

?>

#注以上代碼為顯示php配置信息的簡單php文件代碼,最好手工敲,以防出錯;

#通過訪問并刷新瀏覽器http://ip,如可以看到phpinfo信息,如下圖,說明php環境配置ok;

 

至此LAMP單機環境搭建完成!


附件:http://down.51cto.com/data/2367706
向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

小金县| 革吉县| 邹平县| 九台市| 汝南县| 鄂托克前旗| 泰宁县| 浠水县| 宝清县| 武宣县| 柳河县| 文昌市| 讷河市| 新疆| 临沧市| 本溪市| 丹凤县| 凤阳县| 渝北区| 贵定县| 纳雍县| 镇康县| 潜江市| 卢湾区| 新安县| 肇州县| 任丘市| 贡山| 中江县| 濮阳市| 无锡市| 海兴县| 九寨沟县| 扶沟县| 锦州市| 阿图什市| 炉霍县| 临邑县| 刚察县| 定陶县| 华阴市|