1、首先檢查LAMP環境 2、配置博客軟體(wordpress) 上述mv的原因是cp出錯,查看錯誤日誌 缺少文件,所以cp無法全部拷貝,使用mv 輸入120.25.255.87,進入wordpress設置 3、配置資料庫 因為博客的安裝需要用到資料庫 許可權不夠,因為把httpd.conf用戶改為了 ...
1、首先檢查LAMP環境
[root@cairui htdocs]# ps -ef | grep httpd php 13160 1 0 Mar03 ? 00:00:00 /opt/apache2.2.34/bin/httpd -k start root 19311 1 0 Mar03 ? 00:00:02 /opt/apache2.2.34/bin/httpd -k graceful php 19401 19311 0 Mar03 ? 00:00:00 /opt/apache2.2.34/bin/httpd -k graceful php 19402 19311 0 Mar03 ? 00:00:00 /opt/apache2.2.34/bin/httpd -k graceful php 19403 19311 0 Mar03 ? 00:00:00 /opt/apache2.2.34/bin/httpd -k graceful root 24835 24810 0 09:11 pts/0 00:00:00 grep httpd [root@cairui htdocs]# ps -ef | grep mysql root 1470 1 0 Mar01 ? 00:00:00 /bin/sh /opt/mysql-5.7.21/bin/mysqld_safe --datadir=/opt/mysql-5.7.21/data --pid-file=/opt/mysql-5.7.21/data/cairui.pid mysql 1557 1470 0 Mar01 ? 00:02:51 /opt/mysql-5.7.21/bin/mysqld --basedir=/opt/mysql-5.7.21 --datadir=/opt/mysql-5.7.21/data --plugin-dir=/opt/mysql-5.7.21/lib/plugin --user=mysql --log-error=cairui.err --pid-file=/opt/mysql-5.7.21/data/cairui.pid root 24837 24810 0 09:11 pts/0 00:00:00 grep mysql [root@cairui htdocs]# lsof -i tcp:80 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME AliYunDun 1335 root 18u IPv4 9047 0t0 TCP 120.25.255.87:36408->106.11.68.13:http (ESTABLISHED) httpd 19311 root 3u IPv4 356362 0t0 TCP *:http (LISTEN) httpd 19402 php 3u IPv4 356362 0t0 TCP *:http (LISTEN) httpd 19403 php 3u IPv4 356362 0t0 TCP *:http (LISTEN) [root@cairui htdocs]# lsof -i tcp:3306 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME mysqld 1557 mysql 29u IPv4 9380 0t0 TCP *:mysql (LISTEN)
2、配置博客軟體(wordpress)
WordPress是使用PHP語言開發的博客平臺,用戶可以在支持PHP和MySQL資料庫的伺服器上架設屬於自己的網站。也可以把 WordPress當作一個內容管理系統(CMS)來使用。
WordPress是一款個人博客系統,並逐步演化成一款內容管理系統軟體,它是使用PHP語言和MySQL資料庫開發的。用戶可以在支持 PHP 和 MySQL資料庫的伺服器上使用自己的博客。
WordPress有許多第三方開發的免費模板,安裝方式簡單易用。不過要做一個自己的模板,則需要你有一定的專業知識。比如你至少要懂的標準通用標記語言下的一個應用HTML代碼、CSS、PHP等相關知識。
WordPress官方支持中文版,同時有愛好者開發的第三方中文語言包,如wopus中文語言包。WordPress擁有成千上萬個各式插件和不計其數的主題模板樣式。
[root@cairui software]# wget https://wordpress.org/latest.tar.gz --2018-03-04 09:16:34-- https://wordpress.org/latest.tar.gz Resolving wordpress.org... 198.143.164.252 Connecting to wordpress.org|198.143.164.252|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 8565525 (8.2M) [application/octet-stream] Saving to: “latest.tar.gz” 100%[=========================================================>] 8,565,525 2.83M/s in 2.9s 2018-03-04 09:16:38 (2.83 MB/s) - “latest.tar.gz” saved [8565525/8565525] [root@cairui software]# ls cmake-3.9.6 httpd-2.2.34 latest.tar.gz libiconv-1.15.tar.gz php-7.2.3 cmake-3.9.6.tar.gz httpd-2.2.34.tar.gz libiconv-1.15 mysql-5.7.21 php-7.2.3.tar.gz [root@cairui software]# tar zxf latest.tar.gz [root@cairui software]# ls cmake-3.9.6 httpd-2.2.34.tar.gz libiconv-1.15.tar.gz php-7.2.3.tar.gz cmake-3.9.6.tar.gz latest.tar.gz mysql-5.7.21 wordpress httpd-2.2.34 libiconv-1.15 php-7.2.3 [root@cairui software]# cd wordpress/ [root@cairui wordpress]# ls index.php wp-admin wp-content wp-load.php wp-signup.php license.txt wp-blog-header.php wp-cron.php wp-login.php wp-trackback.php readme.html wp-comments-post.php wp-includes wp-mail.php xmlrpc.php wp-activate.php wp-config-sample.php wp-links-opml.php wp-settings.php [root@cairui wordpress]# cd .. [root@cairui software]# cp wordpress/* /opt/apache/htdocs/ cp: overwrite `/opt/apache/htdocs/index.php'? y cp: omitting directory `wordpress/wp-admin' cp: omitting directory `wordpress/wp-content' cp: omitting directory `wordpress/wp-includes'
[root@cairui apache]# mv /home/cairui/software/wordpress/* /opt/apache/htdocs/
上述mv的原因是cp出錯,查看錯誤日誌
[Sun Mar 04 09:04:36 2018] [error] [client 114.239.215.144] File does not exist: /opt/apache2.2.34/htdocs/favicon.ico, referer: http://120.25.255.87/
缺少文件,所以cp無法全部拷貝,使用mv
輸入120.25.255.87,進入wordpress設置
3、配置資料庫
因為博客的安裝需要用到資料庫
mysql> create database wordpress default character set gbk collate gbk_chinese_ci; #創建一個gbk資料庫,預設是拉丁字元集 Query OK, 1 row affected (0.02 sec) mysql> show databses; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'databses' at line 1 mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | managerie | | mysql | | performance_schema | | sys | | test | | wordpress | +--------------------+ 7 rows in set (0.00 sec) mysql> grant select,delete,insert,update,create on wordpress.* to wordpress@localhost identified by'wordpress'; #給用戶wordpress設置許可權 Query OK, 0 rows affected, 1 warning (0.08 sec) mysql> flush privileges; #刷新許可權 Query OK, 0 rows affected (0.00 sec) mysql> select user,host from mysql.user; +---------------+-----------+ | user | host | +---------------+-----------+ | mysql.session | localhost | | mysql.sys | localhost | | root | localhost | | wordpress | localhost | +---------------+-----------+ 4 rows in set (0.00 sec) mysql> show grants for wordpress@localhost; +------------------------------------------------------------------------------------------+ | Grants for wordpress@localhost | +------------------------------------------------------------------------------------------+ | GRANT USAGE ON *.* TO 'wordpress'@'localhost' | | GRANT SELECT, INSERT, UPDATE, DELETE, CREATE ON `wordpress`.* TO 'wordpress'@'localhost' | +------------------------------------------------------------------------------------------+ 2 rows in set (0.00 sec)
SET PASSWORD FOR 'wordpress'@'localhost' = PASSWORD('wordpress')
許可權不夠,因為把httpd.conf用戶改為了php
[root@cairui apache]# chown -R php.php /opt/apache/htdocs/ [root@cairui apache]# cd htdocs/ [root@cairui htdocs]# ls index.php wp-admin wp-content wp-load.php wp-signup.php license.txt wp-blog-header.php wp-cron.php wp-login.php wp-trackback.php readme.html wp-comments-post.php wp-includes wp-mail.php xmlrpc.php wp-activate.php wp-config-sample.php wp-links-opml.php wp-settings.php [root@cairui htdocs]# ll total 188 -rw-r--r-- 1 php php 418 Sep 25 2013 index.php -rw-r--r-- 1 php php 19935 Jan 7 03:32 license.txt -rw-r--r-- 1 php php 7413 Dec 12 2016 readme.html -rw-r--r-- 1 php php 5434 Sep 23 20:21 wp-activate.php drwxr-xr-x 9 php php 4096 Feb 6 23:49 wp-admin -rw-r--r-- 1 php php 364 Dec 19 2015 wp-blog-header.php -rw-r--r-- 1 php php 1627 Aug 29 2016 wp-comments-post.php -rw-r--r-- 1 php php 2853 Dec 16 2015 wp-config-sample.php drwxr-xr-x 4 php php 4096 Feb 6 23:49 wp-content -rw-r--r-- 1 php php 3669 Aug 20 2017 wp-cron.php drwxr-xr-x 18 php php 12288 Feb 6 23:49 wp-includes -rw-r--r-- 1 php php 2422 Nov 21 2016 wp-links-opml.php -rw-r--r-- 1 php php 3306 Aug 22 2017 wp-load.php -rw-r--r-- 1 php php 36583 Oct 13 10:10 wp-login.php -rw-r--r-- 1 php php 8048 Jan 11 2017 wp-mail.php -rw-r--r-- 1 php php 16246 Oct 4 08:20 wp-settings.php -rw-r--r-- 1 php php 30071 Oct 19 01:36 wp-signup.php -rw-r--r-- 1 php php 4620 Oct 24 06:12 wp-trackback.php -rw-r--r-- 1 php php 3065 Sep 1 2016 xmlrpc.php
mysql> use wordpress Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> show tables; +-----------------------+ | Tables_in_wordpress | +-----------------------+ | wp_commentmeta | | wp_comments | | wp_links | | wp_options | | wp_postmeta | | wp_posts | | wp_term_relationships | | wp_term_taxonomy | | wp_termmeta | | wp_terms | | wp_usermeta | | wp_users | +-----------------------+ 12 rows in set (0.01 sec)
錯誤:進入詳情界面無法顯示(原因,鏈接內包含中文,把鏈接改為英文即可)