Linux使用yum安裝lamp以及部署wordpress實(shí)踐
Linux使用yum安裝lamp,部署wordpress
實(shí)驗(yàn)前需要關(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.同步時(shí)鐘服務(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文件,將時(shí)區(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配置站點(diǎn)
[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站點(diǎn)(192.168.100.20/wp-admin)


總結(jié)
以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
linux corosync+pacemaker+drbd+mysql配置安裝詳解
這篇文章主要介紹了corosync+pacemaker+drbd+mysql配置安裝詳解,需要的朋友可以參考下2016-05-05
CentOS8.0 安裝配置ftp服務(wù)器的實(shí)現(xiàn)方法
這篇文章主要介紹了CentOS8.0 安裝配置ftp服務(wù)器的實(shí)現(xiàn)方法,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-10-10
linux系統(tǒng)之間通過nfs網(wǎng)絡(luò)文件系統(tǒng)掛載設(shè)置方法
NFS允許一個(gè)系統(tǒng)在網(wǎng)絡(luò)上與他人共享目錄和文件,通過使用NFS,用戶和程序可以像訪問本地文件一樣訪問遠(yuǎn)端系統(tǒng)上的文件,下面介紹linux系統(tǒng)之間通過nfs網(wǎng)絡(luò)文件系統(tǒng)掛載的設(shè)置方法2014-01-01

