Linux使用yum安裝lamp以及部署wordpress實踐
Linux使用yum安裝lamp,部署wordpress
實驗前需要關(guān)閉防火墻和selinux
yum源使用網(wǎng)絡(luò)yum源(wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo)
1.同步時鐘服務(wù)器
[root@lamp ~]# systemctl restart chronyd [root@lamp ~]# systemctl enable chronyd [root@lamp ~]# hwclock -w
2.安裝httpd和mariadb(mysql)數(shù)據(jù)庫
yum install httpd mariadb mariadb-server
3.初始化數(shù)據(jù)庫
systemctl restart mariadb systemctl enable mariadb mysql_secure_installation
(除了不允許用戶遠(yuǎn)程登錄選n,其他全都是y,密碼為redhat)
Set root password? [Y/n]y Remove anonymous users? [Y/n] y Disallow root login remotely? [Y/n] n Remove test database and access to it? [Y/n] y Reload privilege tables now? [Y/n] y
安裝php
[root@xieyuhui2 ~]# yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y [root@xieyuhui2 ~]# yum install yum-utils -y [root@xieyuhui2 ~]# yum-config-manager --enable remi-php70
安裝php相關(guān)插件
[root@xieyuhui2 ~]# yum install php php-cli php-fpm php-gd php-curl php-zip php-mbstring php-opcache php-intl php-mysqlnd -y
配置php文件,將時區(qū)改為亞洲/上海
[root@xieyuhui2 ~]# vim /etc/php.ini

重啟服務(wù)
[root@xieyuhui2 ~]# systemctl restart php-fpm [root@xieyuhui2 ~]# systemctl enable php-fpm
配置默認(rèn)網(wǎng)頁
[root@xieyuhui2 ~]# vim /etc/httpd/conf/httpd.conf

[root@xieyuhui2 ~]# vim /var/www/html/index.php

重啟服務(wù)
[root@xieyuhui2 ~]# systemctl restart httpd [root@xieyuhui2 ~]# systemctl enable httpd
查看php版本是否正確

上傳wordpress壓縮包然后解壓

將wordpress復(fù)制到/var/www/html內(nèi)
[root@xieyuhui2 ~]# cp -R wordpress /var/www/html/

設(shè)置wordpress所屬者和所屬組為apache,權(quán)限為775
[root@xieyuhui2 ~]# chown -R apache.apache / var/www/html/wordpress/ [root@xieyuhui2 ~]# chmod -R 775 /var/www/html/wordpress/

配置wordpress數(shù)據(jù)庫
[root@xieyuhui2 html]# mysql -uroot -p
MariaDB [(none)]> create database wordpress; MariaDB [(none)]> create user 'wordpress_use'@'localhost' identified by 'redhat'; MariaDB [(none)]> grant all on wordpress.* to 'wordpress_user'@'localhost'; MariaDB [(none)]> flush privileges;
為wordpress配置站點
[root@xieyuhui2 ~]# cp -p /usr/share/doc/httpd-2.4.6/httpd-vhosts.conf /etc/httpd/conf.d/ #覆蓋虛擬機(jī)主配置文件,<Directory>是httpd/conf/httpd.conf里的配置文件

重啟服務(wù)
[root@xieyuhui2 ~]# systemctl restart httpd
在瀏覽器訪問wordpress站點(192.168.100.20/wp-admin)


總結(jié)
以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
keeplive+mysql+drbd高可用架構(gòu)安裝步驟
本地(master)與遠(yuǎn)程主機(jī)(backup)的保證實時同步,如果本地系統(tǒng)出現(xiàn)故障時,遠(yuǎn)程主機(jī)上還會保留有一份相同的數(shù)據(jù),可以繼續(xù)使用.在高可用(HA)中使用DRBD功能,可以代替使用一個共享盤陣.因為數(shù)據(jù)同時存在于本地主機(jī)和遠(yuǎn)程主機(jī)上,切換時,遠(yuǎn)程主機(jī)只要使用它上面的那份備份數(shù)據(jù)2017-08-08
centos 6.9 升級glibc動態(tài)庫的詳細(xì)過程
glibc是gnu發(fā)布的libc庫,即c運行庫,glibc是linux系統(tǒng)中最底層的api,幾乎其它任何運行庫都會依賴于glibc。這篇文章主要介紹了centos 6.9 升級glibc動態(tài)庫的詳細(xì)過程,需要的朋友可以參考下2019-11-11
在Linux/Windows系統(tǒng)中設(shè)置PYTHONPATH環(huán)境變量的操作步驟
PYTHONPATH 是一個環(huán)境變量,它告訴 Python 解釋器在哪些目錄中查找要導(dǎo)入的模塊,這對于包含不在標(biāo)準(zhǔn)目錄中的自定義模塊非常有用,本文給大家介紹了如何在 Linux/Windows 系統(tǒng)中設(shè)置 PYTHONPATH 環(huán)境變量,需要的朋友可以參考下2025-02-02

