在Arch Linux上安装Wordpress

时间:2020-02-23 14:45:26  来源:igfitidea点击:

WordPress是世界上最常用的CMS系统之一。
它的成功采用是通过其开源性质实现的。
WordPress在GPLv2下获得许可,并且具有大量主题和插件,从而使其简单自定义。
在本教程中,我将显示如何在arch和配置PHP和MySQL数据库上设置WordPress的完整步骤。
WordPress易于自定义和管理且非常强大的内容管理系统。
在Arch Linux上安装WordPress,并通过这种简单的过程来通过在终端上发出少量命令来完成。
让我们开始。

设置WordPress和配置

安装Apache Web服务器

# pacman -Sy apache

开始apache.

# systemctl start httpd

启用Apache以启动启动

# systemctl start httpd

安装PHP.

# pacman -Sy php php-{cgi,gd,pgsql}

示例

root@darkpy:pts/5-> /root (0)
> sudo pacman -Sy php php-{cgi,gd,pgsql}
:: Synchronizing package databases…
core is up to date
extra is up to date
community is up to date
multilib is up to date
archlinuxfr is up to date
archlinuxcn is up to date
warning: php-7.0.7-1 is up to date – reinstalling
warning: php-gd-7.0.7-1 is up to date – reinstalling
resolving dependencies…
looking for conflicting packages…
Packages (4) php-7.0.7-1 php-cgi-7.0.7-1 php-gd-7.0.7-1 php-pgsql-7.0.7-1
Total Download Size: 2.06 MiB
Total Installed Size: 24.44 MiB
Net Upgrade Size: 9.18 MiB
:: Proceed with installation? [Y/n] y
:: Retrieving packages…
php-cgi-7.0.7-1-x86_64 2.0 MiB 490K/s 00:04 [######################] 100%
php-pgsql-7.0.7-1-x… 52.6 KiB 202K/s 00:00 [######################] 100%
(4/4) checking keys in keyring [######################] 100%
(4/4) checking package integrity [######################] 100%
(4/4) loading package files [######################] 100%
(4/4) checking for file conflicts [######################] 100%
(4/4) checking available disk space [######################] 100%
:: Processing package changes…
(1/4) reinstalling php [######################] 100%
(2/4) installing php-cgi [######################] 100%
(3/4) reinstalling php-gd [######################] 100%
(4/4) upgrading php-pgsql [######################] 100%
:: Running post-transaction hooks…
(1/1) Updating manpage index…

安装MariaDB数据库服务

# pacman -S libmariadbclient mariadb mariadb-clients

设置基本配置

# mysql_install_db –user=mysql –basedir=/usr –datadir=/var/lib/mysql

开始和启用MariaDB

# systemctl enable mysqld.service
# systemctl start mysqld.service

MariaDB的设置root密码

# mysql_secure_installation

有关详细信息,请参阅下图:如果我们确实升级,只需输入:

# mysql_upgrade -u root -p

确认确保我们已正确配置的"/etc/hosts`文件"。
如果我们正在使用域的LAN上访问WordPress站点,这是至关重要的。

# cat /etc/hosts

我的输出如下所示

#  
127.0.0.1 localhost.localdomain localhost
::1 localhost.localdomain localhost

配置PHP.

# vim /etc/httpd/conf/httpd.conf

评论以下行:

#LoadModule mpm_event_module modules/mod_mpm_event.so

下面的取消注释:

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

在"LoadModule Dir_Module Modules/Mod_Dir.so`之后,在LoadModule列表中放置在LoadModule列表中:

LoadModule php7_module modules/libphp7.so

在"附件"列表结束时,添加:

Include conf/extra/php7_module.conf

启用MySQLI和GD模块:

# vim /etc/php/php.ini

确保以下线路取消关注

extension=mysqli.so
extension=gd.so

重新启动Apache:

# systemctl restart httpd

然后:

# mysql -u root -p$password

我们将删除MySQL CLI终端:

# mysql -u root -p$password
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 4
Server version: 10.1.14-MariaDB MariaDB Server
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type ’help;’ or ’h’ for help. Type ’c’ to clear the current input statement.
MariaDB [(none)]>

创建数据库和数据库用户并授予权限:

CREATE DATABASE wordpress;
CREATE USER ’wordpressuser ’@’localhost’ IDENTIFIED BY ’password’;
GRANT ALL PRIVILEGES ON wordpress.* TO ’wordpressuser’@’localhost’;
FLUSH PRIVILEGES;
q

请记住相应地更改WordPress用户和数据库名称。

安装WordPress

# cd /srv/http/
# wget https://wordpress.org/latest.tar.gz# tar xvzf latest.tar.gz
# cd wordpress

修改WordPress到HTTP的组所有权

# chown -R root:http /srv/http/wordpress

创建和修改配置文件

# cd /srv/http/wordpress
# cp wp-config-sample.php wp-config.php

编辑wp-config.php配置数据库用户,数据库名称和数据库密码:

# vim wp-config.php

修改如下

/** The name of the database for WordPress */
define(‘DB_NAME’, ’wordpress’);
/** MySQL database username */
define(‘DB_USER’, ’wordpressuser’);
/** MySQL database password */
define(‘DB_PASSWORD’, ’password’);

请参阅下面的屏幕截图。

在浏览器上打开WordPress

我们已经完成了WordPress的安装,只需在我们喜欢的浏览器上执行URL以下

http://localhost/wordpress

你会看到如下所示的窗口

设置:博客TitlePassWorduser登录

然后登录

安装WordPress模板

从http://themeforest.net/?ref=josemutai下载最佳wordpress模板下载我们喜欢的主题,然后转到:仪表板>外观>主题>添加新>添加主题>上传主题>浏览>选择文件,然后找到主题文件并上传它。