系統(tǒng)運(yùn)維 一、安裝Apache服務(wù)
關(guān)于安裝Apache詳細(xì)配置及原理概述請(qǐng)參考:CentOS 7.4搭建Apache網(wǎng)站服務(wù)
[root@centos01 ~]# mount /dev/cdrom /mnt/ <!--掛載LAMP光盤-->
[root@centos01 ~]# cp /mnt/* /usr/src/ <!--將mnt目錄下的程序包拷貝到/usr/src/-->
[root@centos01 ~]# mount /dev/cdrom /mnt/ <!--切換操作系統(tǒng)光盤-->
[root@centos01 ~]# rm -rf /etc/yum.repos.d/CentOS-* <!--刪除系統(tǒng)自動(dòng)yum-->
[root@centos01 ~]# tar zxvf /usr/src/httpd-2.2.17.tar.gz -C /usr/src/ <!--解壓縮Apache包-->
[root@centos01 ~]# cd /usr/src/httpd-2.2.17/ <!--進(jìn)入Apache目錄-->
[root@centos01 httpd-2.2.17]# ./configure
--prefix=/usr/local/httpd
--enable-so
--enable-rewrite
--enable-charset-lite
--enable-cgi <!--配置httpd-->
[root@centos01 httpd-2.2.17]# make && make install <!--編輯和安裝httpd-->
[root@centos01 ~]# ln -s /usr/local/httpd/bin/* /usr/local/bin/ <!--優(yōu)化程序執(zhí)行命令-->
[root@centos01 ~]# cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd <!--生成apahce服務(wù)-->
[root@centos01 ~]# chmod +x /etc/init.d/httpd <!--添加執(zhí)行權(quán)限-->
[root@centos01 ~]# vim /etc/init.d/httpd <!--修改Apache服務(wù)控制文件-->
#chkconfig:35 80 20
#description:apache
[root@centos01 ~]# chkconfig --add httpd <!--添加為系統(tǒng)服務(wù)-->
[root@centos01 ~]# chkconfig --level 35 httpd on <!--設(shè)置開機(jī)自動(dòng)啟動(dòng)-->
[root@centos01 ~]# vim /usr/local/httpd/conf/httpd.conf <!--修改Apache主配置文件-->
98 ServerName 192.168.100.10:80 <!--修改服務(wù)器IP地址-->
[root@centos01 ~]# systemctl start httpd <!--啟動(dòng)Apache服務(wù)-->
[root@centos01 ~]# netstat -anptu | grep 80 <!--監(jiān)聽Apache端口號(hào)-->
tcp6 0 0 :::80 :::* LISTEN 53682/httpd
二、安裝mysql數(shù)據(jù)庫安裝Mysql詳細(xì)配置及MYSQL原理概述請(qǐng)參考:Centos安裝MySQL數(shù)據(jù)庫
[root@centos01 ~]# groupadd mysql <!--創(chuàng)建管理MySQL的組-->
[root@centos01 ~]# useradd -M -s /sbin/nologin -g mysql mysql <!--創(chuàng)建管理MySQL的用戶-->
[root@centos01 ~]# yum -y install ncurses-devel <!--安裝依賴程序-->
[root@centos01 ~]# tar zxvf /usr/src/cmake-2.8.6.tar.gz -C /usr/src/ <!--解壓縮cmake包-->
[root@centos01 ~]# cd /usr/src/cmake-2.8.6/ <!--進(jìn)入cmake目錄-->
[root@centos01 cmake-2.8.6]# ./configure && gmake && gmake install <!--安裝cmake-->
[root@centos01 ~]# tar zxvf /usr/src/mysql-5.5.22.tar.gz -C /usr/src/ <!--解壓縮MySQL包-->
[root@centos01 ~]# cd /usr/src/mysql-5.5.22/ <!--進(jìn)入MySQL目錄-->
[root@centos01 mysql-5.5.22]# cmake
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql
-DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci
-DWITH_EXTRA_CHARSETS=all
-DSYSCONFDIR=/etc <!--配置MySQL-->
[root@centos01 mysql-5.5.22]# make && make install <!--安裝MySQL-->
[root@centos01 mysql-5.5.22]# cp support-files/my-medium.cnf /etc/my.cnf <!--生成MySQL配置文件-->
cp:是否覆蓋/etc/my.cnf? y <!--輸入y-->
[root@centos01 mysql-5.5.22]# cp support-files/mysql.server /etc/init.d/mysqld
<!--生成服務(wù)控制文件-->
[root@centos01 ~]# chmod +x /etc/init.d/mysqld <!--控制文件添加執(zhí)行權(quán)限-->
[root@centos01 ~]# chkconfig --add mysqld <!--添加系統(tǒng)服務(wù)-->
[root@centos01 ~]# chkconfig --level 35 mysqld on <!--設(shè)置開機(jī)自動(dòng)啟動(dòng)-->
[root@centos01 ~]# vim /etc/profile <!--優(yōu)化程序執(zhí)行命令->
PATH=$PATH:/usr/local/mysql/bin <!--添加此行-->
[root@centos01 ~]# source /etc/profile <!--刷新-->
[root@centos01 ~]# /usr/local/mysql/scripts/mysql_install_db
--user=mysql
--basedir=/usr/local/mysql
--datadir=/usr/local/mysql/data <!--初始化MySQL-->
[root@centos01 ~]# chown -R mysql:mysql /usr/local/mysql/ <!--修改MySQL安裝目錄的所有者-->
[root@centos01 ~]# systemctl start mysqld <!--啟動(dòng)MySQL服務(wù)-->
[root@centos01 ~]# mysqladmin -uroot password <!--設(shè)置管理MySQL密碼-->
New password: <!--輸入密碼-->
Confirm new password: <!--確認(rèn)密碼-->
[root@centos01 ~]# mysql -uroot -ppwd@123 <!--登錄MySQL測(cè)試-->
三、安裝PHP安裝PHP詳細(xì)配置及原理概述請(qǐng)參考:Centos 7搭建LNMP架構(gòu)及部署Discuz論壇
[root@centos01 ~]# yum -y install zlib-devel libxml2-devel <!--安裝php依賴程序-->
[root@centos01 ~]# tar zxvf /usr/src/libmcrypt-2.5.8.tar.gz -C /usr/src/ <!--解壓縮libmcrypt包-->
[root@centos01 ~]# cd /usr/src/libmcrypt-2.5.8/ <!--進(jìn)入libmcrypt目錄-->
[root@centos01 libmcrypt-2.5.8]# ./configure && make && make install <!--安裝libmcrypt-->
[root@centos01 libmcrypt-2.5.8]# ln -s /usr/local/lib/libmcrypt.* /usr/lib/ <!--優(yōu)化路徑-->
[root@centos01 ~]# tar zxvf /usr/src/mhash-0.9.9.9.tar.gz -C /usr/src <!--解壓縮mhash包-->
[root@centos01 ~]# cd /usr/src/mhash-0.9.9.9/ <!--進(jìn)入mhash目錄-->
[root@centos01 mhash-0.9.9.9]# ./configure && make && make install <!--安裝mhash-->
[root@centos01 mhash-0.9.9.9]# ln -s /usr/local/lib/libmhash.* /usr/lib/ <!--優(yōu)化路徑-->
[root@centos01 ~]# tar zxvf /mnt/mcrypt-2.6.8.tar.gz -C /usr/src/ <!--解壓縮mcrypt-->
[root@centos01 ~]# cd /usr/src/mcrypt-2.6.8/ <!--進(jìn)入mcrypt目錄-->
[root@centos01 mcrypt-2.6.8]# ./configure <!--配置mcrypt-->
[root@centos01 mcrypt-2.6.8]# export LD_LIBRARY_PATH=/usr/local/lib <!--輸入變量-->
[root@centos01 mcrypt-2.6.8]# ./configure <!--重新配置-->
[root@centos01 mcrypt-2.6.8]# make && make install <!--編譯安裝mcrypt-->
[root@centos01 ~]# tar zxvf /usr/src/php-5.3.28.tar.gz -C /usr/src/ <!--解壓縮php包-->
[root@centos01 ~]# cd /usr/src/php-5.3.28/ <!--進(jìn)入php目錄-->
[root@centos01 php-5.3.28]# ./configure --prefix=/usr/local/php --with-mcrypt --with-apxs2=/usr/local/httpd/bin/apxs --with-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/mysql/bin/mysql_config --with-config-file-path=/usr/local/php --enable-mbstring <!--配置php-->
[root@centos01 php-5.3.28]# make && make install <!--編譯安裝php-->
[root@centos01 php-5.3.28]# cp php.ini-production /usr/local/php/php.ini <!--生成php配置文件-->
[root@centos01 ~]# tar zxvf /usr/src/zendguardloader-php-5.3-linux-glibc23-i386.tar.gz
-C /usr/src/ <!--解壓縮zend加速訪問模塊-->
[root@centos01 ~]# cd /usr/src/ZendGuardLoader-php-5.3-linux-glibc23-i386
/php-5.3.x/
[root@centos01 php-5.3.x]# ls
ZendGuardLoader.so
[root@centos01 php-5.3.x]# cp ZendGuardLoader.so /usr/local/php/lib/php/ <!--復(fù)制zend加速訪問模塊-->
[root@centos01 php-5.3.x]# vim /usr/local/php/php.ini <!--加載zend加速訪問模塊-->
[PHP]
zend_extension=/usr/local/php/lib/php/ZendGuardLoader.so
zend_loader.enable=1
[root@centos01 ~]# vim /usr/local/httpd/conf/httpd.conf
<!--修改Apache主配置文件支持php-->
99 ServerName 192.168.100.10:80 <!--Apache服務(wù)器IP地址和端口號(hào)-->
168 DirectoryIndex index.html index.php
311 AddType application/x-httpd-php .php
[root@centos01 ~]# systemctl restart httpd <!--重新啟動(dòng)apache服務(wù)-->
[root@centos01 ~]# vim /usr/local/httpd/htdocs/index.php <!--編寫測(cè)試php文件-->
<?php
phpinfo();
?>
四、部署phpMyadmin系統(tǒng)
[root@centos01 ~]# tar zxvf /usr/src/phpmyadmin-3.3.10-all-languages.tar.gz -C /usr/src/ <!--解壓縮phpMyAdmin-->
[root@centos01 ~]# mv /usr/src/phpMyAdmin-3.3.10-all-languages/
/usr/local/httpd/htdocs/phpMyAdmin <!--修改phpmyadmin位置到網(wǎng)站根目錄-->
[root@centos01 ~]# cp /usr/local/httpd/htdocs/phpMyAdmin/config.sample.inc.php
/usr/local/httpd/htdocs/phpMyAdmin/config.inc.php<!--創(chuàng)建phpmyadmin系統(tǒng)配置文件-->
1、用戶訪問phpmyadmin系統(tǒng)五、安裝dns安裝DNS詳細(xì)配置及原理概述請(qǐng)參考:CentOS7簡(jiǎn)單搭建DNS服務(wù)
[root@centos01 ~]# yum -y install bind bind-chroot bind-utils
[root@centos01 ~]# cp /etc/named.conf /etc/named.conf.bak
[root@centos01 ~]# echo > /etc/named.conf
[root@centos01 ~]# vim /etc/named.conf
options{
listen-on port 53 { any; };
directory /var/named;
};
zone benet.com IN {
type master;
file benet.com.zone;
allow-transfer { any; };
};
[root@centos01 ~]# named-checkconf -z /etc/named.conf
[root@centos01 ~]# vim /var/named/benet.com.zone
$TTL 86400
@ SOA benet.com. root.benet.com(
2020020710
1H
15M
1W
1D
)
@ NS centos01.benet.com.
centos01 A 192.168.100.10
www A 192.168.100.10
[root@centos01 ~]# named-checkzone benet.com /var/named/benet.com.zone
[root@centos01 ~]# chmod 755 /var/named/benet.com.zone
[root@centos01 ~]# chown named:named /var/named/benet.com.zone
[root@centos01 ~]# systemctl start named
[root@centos01 ~]# systemctl enable named
1、使用域名訪問phpmyadmin系統(tǒng)———————— 本文至此結(jié)束,感謝閱讀 ————————
當(dāng)前名稱:CentOS7搭建LAMP環(huán)境上線PHPMyAdmin系統(tǒng)
文章分享:http://www.rwnh.cn/article16/cgpegg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供靜態(tài)網(wǎng)站、電子商務(wù)、網(wǎng)站收錄、面包屑導(dǎo)航、App開發(fā)、網(wǎng)站導(dǎo)航
聲明:本網(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í)需注明來源: 創(chuàng)新互聯(lián)