如何在Ubuntu/Linux Mint上快速安装WordPress


WordPress是一个免费的开源网站和博客工具,它是互联网上最流行的CMS(内容管理系统)。它允许您在MySQL后端和PHP处理的基础上轻松设置灵活的博客和网站。本文介绍了“如何使用bash脚本在Linux上安装WordPress”。Bash脚本会自动下载并在您选择的任何位置安装最新版本的WordPress。

安装LAMP

要在您的系统上安装并运行WordPress,需要在您的Web服务器上进行预安装。

使用以下命令安装LAMP Web服务器。

$ sudo apt-get install lamp-server^

示例输出如下:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'mysql-server-core-5.5' for task 'lamp-server'
Note, selecting 'mysql-server-5.5' for task 'lamp-server'
Note, selecting 'libaio1' for task 'lamp-server'
Note, selecting 'mysql-client-core-5.5' for task 'lamp-server'
Note, selecting 'apache2-mpm-prefork' for task 'lamp-server'
Note, selecting 'libaprutil1' for task 'lamp-server'
Note, selecting 'libapache2-mod-php5' for task 'lamp-server'
Note, selecting 'php5-mysql' for task 'lamp-server'
Note, selecting 'php5-common' for task 'lamp-server'
Note, selecting 'libaprutil1-dbd-sqlite3' for task 'lamp-server'
Note, selecting 'php5-readline' for task 'lamp-server'
Note, selecting 'ssl-cert' for task 'lamp-server'
Note, selecting 'mysql-client-5.5' for task 'lamp-server'
Note, selecting 'libhtml-template-perl' for task 'lamp-server'
Note, selecting 'libterm-readkey-perl' for task 'lamp-server'
Note, selecting 'libaprutil1-ldap' for task 'lamp-server'
Note, selecting 'mysql-common' for task 'lamp-server'
Note, selecting 'php5-cli' for task 'lamp-server'
Note, selecting 'libmysqlclient18' for task 'lamp-server'
Note, selecting 'apache2-data' for task 'lamp-server'
Note, selecting 'php5-json' for task 'lamp-server'
Note, selecting 'libapr1' for task 'lamp-server'
Note, selecting 'apache2' for task 'lamp-server'
................................................

要重新启动Apache2,请使用以下命令:

$ sudo service apache2 restart

要重新启动mySQL,请使用以下命令:

$ sudo service mysql restart

现在打开localhost目录,使用以下命令打开localhost目录:

$ cd /var/www/html

现在使用**wget**命令访问wp-install.sh,使用以下命令:

$ sudo wget https://goo.gl/MndEJc --no-check-certificate -O wp-install.sh

示例输出如下:

--2016-03-16 12:13:06-- https://goo.gl/MndEJc
Resolving goo.gl (goo.gl)... 216.58.196.110, 2404:6800:4007:806::200e
Connecting to goo.gl (goo.gl)|216.58.196.110|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://raw.githubusercontent.com/WebPraktikos/wp-install/master/wp-install.sh [following]
--2016-03-16 12:13:06-- https://raw.githubusercontent.com/WebPraktikos/wp-install/master/wp-install.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 103.245.222.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|103.245.222.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4410 (4.3K) [text/plain]
Saving to: ‘wp-install.sh’

100%[======================================>] 4,410 --.-K/s in 0s

2016-03-16 12:13:07 (1003 MB/s) - ‘wp-install.sh’ saved [4410/4410]

要安装wp-install.sh,请使用以下命令:

$ sudo bash wp-install.sh

示例输出如下:

creating: w3-total-cache/lib/EDD/
inflating: w3-total-cache/lib/EDD/integration.php
inflating: w3-total-cache/lib/EDD/EDD_SL_Plugin_Updater.php
creating: w3-total-cache/lib/SNS/
creating: w3-total-cache/lib/SNS/lib/
creating: w3-total-cache/lib/SNS/lib/requestcore/
inflating: w3-total-cache/lib/SNS/lib/requestcore/requestcore.class.php
inflating: w3-total-cache/lib/SNS/lib/requestcore/cacert.pem
inflating: w3-total-cache/lib/SNS/lib/requestcore/README.md
inflating: w3-total-cache/lib/SNS/lib/requestcore/LICENSE
creating: w3-total-cache/lib/SNS/utilities/
inflating: w3-total-cache/lib/SNS/utilities/utilities.class.php
inflating: w3-total-cache/lib/SNS/utilities/request.class.php
inflating: w3-total-cache/lib/SNS/utilities/response.class.php
inflating: w3-total-cache/lib/SNS/utilities/simplexml.class.php
inflating: w3-total-cache/lib/SNS/README.md
inflating: w3-total-cache/lib/SNS/sdk.class.php
creating: w3-total-cache/lib/SNS/services/
creating: w3-total-cache/lib/SNS/services/MessageValidator/
inflating: w3-total-cache/lib/SNS/services/MessageValidator/MessageValidator.php
inflating: w3-total-cache/lib/SNS/services/MessageValidator/sns-exceptions.php
inflating: w3-total-cache/lib/SNS/services/MessageValidator/Message.php
inflating: w3-total-cache/lib/SNS/services/sns.class.php
creating: w3-total-cache/lib/Microsoft/
..........................................................

安装**WordPress**期间,系统会询问数据库名称和密码。请确保提供正确的资料来设置WordPress。在您喜欢的Web浏览器中输入以下URL:

https://127.0.0.1/wp-admin/install.php

示例输出如下:


根据您的需要填写详细信息,然后按安装WordPress按钮。成功完成所有步骤后,您将看到如下所示的屏幕:


恭喜!现在,您知道了“如何在Ubuntu/Linux Mint上快速安装WordPress”。我们将在下一篇文章中学习更多关于这些类型的Linux命令。继续关注!

更新于:2020年1月20日

968 次浏览

开启您的职业生涯

通过完成课程获得认证

开始学习
广告