Apache Web:
yum install httpd
systemctl start httpd.service
iptables -I INPUT -p TCP –dport 80 -j ACCEPT
or
firewall-cmd –permanent –zone=public –add-service=http
firewall-cmd –permanent –zone=public –add-service=https
firewall-cmd –reload
systemctl enable httpd.service
Mysql(MariaDB):
yum install mariadb-server mariadb
systemctl start mariadb
mysql_secure_installation
然后会提示你输入数据库的root账号密码,如果是新安装的则输入空格,如下所示:
In order to log into MariaDB to secure it, we’ll need the current
password for the root user. If you’ve just installed MariaDB, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
In order to log into MariaDB to secure it, we’ll need the current
password for the root user. If you’ve just installed MariaDB, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
然后我们输入空格,继续设置root密码:
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
… Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n]
… Success!
Normally, root should only be allowed to connect from ‘localhost’. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n]
… Success!
By default, MariaDB comes with a database named ‘test’ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n]
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n]
… Success!
Cleaning up…
All done! If you’ve completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
systemctl enable mariadb.service
Install PHP:
sudo yum install php php-mysql
sudo systemctl restart httpd.service
P我们可以在网站目录下面建立一个info.php的文件来查看php的安装情况我们在/var/www/html目录创建一个info.php的文件:
sudo vi /var/www/html/info.php
<?php phpinfo(); ?>
打开http://your_server_IP_address/info.php or phpinfp.php
Install phpMyAdmin:
yum install epel-release
yum install phpmyadmin
/etc/httpd/conf.d/phpMyAdmin.conf:
Alias /phpmyadmin /usr/share/phpMyAdmin
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 127.0.0.1
Require ip ::1
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
more settings:
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
#Require ip 127.0.0.1
#Require ip ::1
Require all granted
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
# Deny from All
# Allow from 127.0.0.1
# Allow from ::1
Allow from All
</IfModule>
</Directory>
systemctl restart httpd.service
http://server_domain_or_IP/phpMyAdmin
Install WordPress:
DB settings:
# 登录数据库
mysql -u root -p
# 创建数据库
CREATE DATABASE wordpress;
# 创建数据库用户和密码
CREATE USER wordpressuser@localhost IDENTIFIED BY ‘wordress_password’;
# 设置wordpressuser访问wordpress数据库权限
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY ‘wordress_password’;
# 刷新数据库设置
FLUSH PRIVILEGES;
# 退出数据库
exit
Download wordpress:
cd ~
wget http://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
cp -r ~/wordpress/ /var/www/html/wordpress/
cd /var/www/html/wordpress
cp wp-config-sample.php wp-config.php
sudo vim wp-config.php
// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘database_name_here’);
/** MySQL database username */
define(‘DB_USER’, ‘username_here’);
/** MySQL database password */
define(‘DB_PASSWORD’, ‘password_here’);
/** MySQL hostname */
define(‘DB_HOST’, ‘localhost’);
http://server_domain_or_IP or http://server_domain_or_IP/wordpress