溫馨提示×

溫馨提示×

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

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

編譯安裝搭建wordpress

發(fā)布時間:2020-08-05 02:18:09 來源:網(wǎng)絡 閱讀:377 作者:不會運維 欄目:系統(tǒng)運維
  • 編譯安裝搭建wordpress
名稱 版本 包名
Centos 7.4 CentOS Linux release 7.4.1708 (Core)
Apache 2.4.37 httpd-2.4.37.tar.bz2
APR 1.6.5 apr-1.6.5.tar.bz2
APR-util 1.6.1 apr-util-1.6.1.tar.bz2
PHP 7.1.18 php-7.1.18.tar.bz2
Mariadb 10.2.15 mariadb-10.2.15-linux-x86_64.tar.gz
WordPress 4.9.4 wordpress-4.9.4-zh_CN.tar.gz

1.編譯安裝httpd
(1)解壓httpd,APR,APR-util的軟件包

tar xvf  apr-1.6.5.tar.bz2 
tar xvf apr-util-1.6.1.tar.bz2 
tar xvf httpd-2.4.37.tar.bz2

(2)將APR和APR-util目錄移動到httpd的srclib目錄下

 mv apr-util-1.6.1 httpd-2.4.37/srclib/apr-util
 mv apr-1.6.5 httpd-2.4.37/srclib/apr

(3)開始編譯:

cd httpd-2.4.37/
./configure --prefix=/app/httpd24 --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib--with-pcre --with-included-apr --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork
make & make install

(4)創(chuàng)建用戶環(huán)境

useradd -r -s /sbin/nologin apache
[root@localhost src]#  vim /etc/profile.d/httpd24.sh
export PATH=/app/httpd24/bin/:$PATH
. /etc/profile.d/httpd24.sh

(5)使用apachectl命令控制Apache服務
apachectl --options
2.二進制安裝Mariadb
(1)準備用戶:
useradd -r -d /data/mysql mysql
(2)準備數(shù)據(jù)目錄:

mkdir /data/mysq
chown  mysql:mysql /data/mysqll

(3)準備二進制程序

tar xvf mariadb-10.2.15-linux-x86_64.tar.gz  -C /usr/local/
 cd /usr/local/
 ln -sv mariadb-10.2.15-linux-x86_64 mysql
 chown -R root:mysql /usr/local/mysql/

(4)配置文件

mkdir /etc/mysql/
cp /usr/local/mysql/support-files/my-large.cnf /etc/mysql/my.cnf
[mysql]中添加
datadir = /data/mysql
innodb_file_per_table = on
skip_name_resolve = on 

(5)創(chuàng)建數(shù)據(jù)庫文件

cd /usr/local/mysql/
./scripts/mysql_install_db --datadir=/data/mysql --user=mysql

(6)準備服務腳本,并啟動腳本

 cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld
 chkconfig --add mysqld
 service  mysqld start 

(7)PATH路徑

echo ‘PATH=/user/local/mysql/bin:$PATH’ > /etc/profile.d/mysql.sh
.   /etc/profile.d/mysql.sh

(8)創(chuàng)建數(shù)據(jù)庫和授權用戶

mysql>create database wordpress;
mysql>grant all on wordpress.* to wpuser@'172.20.10/e.%' identified by 'wpuser';

3.編譯安裝PHP
(1)安裝相關軟件包
yum install libxml2-devel bzip2-devel libmcrypt-devel -y
(2)解壓PHP并安裝

tar xvf php-7.1.18.tar.xz 
cd php-7.1.18/
./configure --prefix=/app/php --enable-mysqlnd --with-mysqli=mysqlnd --with-openssl --with-pdo-mysql=mysqlnd --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --with-apxs2=/app/httpd24/bin/apxs --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --enable-maintainer-zts --disable-fileinfo
make && make install

(3)配置文件設置

cp php.ini-production /etc/php.ini
vim /etc/httpd24/httpd.conf
 <IfModule dir_module>         
        DirectoryIndex index.php index.html               
    </IfModule>
#在文件最后寫入下面兩行代碼
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps

(4)測試連接數(shù)據(jù)庫

[root@localhost htdocs]# vim mysql.php 
<?php
    $mysqli=new mysqli("172.20.10.5","wpuser","wppass");
    if(mysqli_connect_errno()){
                echo "連接數(shù)據(jù)庫失敗!";
                $mysqli=null;
                exit;
                }
                echo "連接數(shù)據(jù)庫成功!";
                $mysqli->close();
?>

編譯安裝搭建wordpress
4.設置wordpress
(1)解壓wordpress包

tar xvf wordpress-4.9.4-zh_CN.tar.gz
mv wordpress /app/httpd24/htdocs/blog 

(2)修改wordpress配置文件

[root@localhost blog]# vim wp-config.php
// ** MySQL 設置 - 具體信息來自您正在使用的主機 ** //
/** WordPress數(shù)據(jù)庫的名稱 */
define('DB_NAME', 'wordpress');

/** MySQL數(shù)據(jù)庫用戶名 */
define('DB_USER', 'wpuser');

/** MySQL數(shù)據(jù)庫密碼 */
define('DB_PASSWORD', 'wppass');

/** MySQL主機 */
define('DB_HOST', '172.20.10.5');

/** 創(chuàng)建數(shù)據(jù)表時默認的文字編碼 */
define('DB_CHARSET', 'utf8');

(3)設置登錄賬號
編譯安裝搭建wordpress
(4)登錄:
編譯安裝搭建wordpress
(5)訪問:
編譯安裝搭建wordpress

向AI問一下細節(jié)

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

AI