■Debian WheezyにWordPress(MySQL版)を導入する
外部に公開しない環境下でリモートインストールする
$ sudo apt-get install -y wordpress curl apache2 mysql-server
■パスワードの再設定
$ sudo dpkg-reconfigure mysql-server-5.6
■コンテンツをapache2にリンクする
$ ls /usr/share/wordpress /var/lib/wordpress/wp-content/
/usr/share/wordpress:
index.php wp-admin wp-config-sample.php wp-cron.php wp-load.php wp-settings.php xmlrpc.php
readme.html wp-blog-header.php wp-config.php wp-includes wp-login.php wp-signup.php
wp-activate.php wp-comments-post.php wp-content wp-links-opml.php wp-mail.php wp-trackback.php
/var/lib/wordpress/wp-content/:
blogs.dir languages plugins themes uploads
$ echo ' Alias /wp/wp-content /var/lib/wordpress/wp-content
Alias /wp /usr/share/wordpress
<Directory /usr/share/wordpress>
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
Order allow,deny
Allow from all
</Directory>
<Directory /var/lib/wordpress/wp-content>
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>
' | sudo tee /etc/apache2/sites-available/wp > /dev/null
$ sudo a2ensite wp
Enabling site wp.
To activate the new configuration, you need to run:
service apache2 reload
$ sudo /etc/init.d/apache2 reload
[ ok ] Reloading web server config: apache2.
$ w3m -dump -no-proxy http://localhost/wp
Neither /etc/wordpress/config-localhost.php nor /etc/wordpress/
config-localhost.php could be found.
Ensure one of them exists, is readable by the webserver and contains the right
password/username.
■MySQLとの連携設定
$ echo "<?php
define('DB_NAME', 'wordpress');
define('DB_USER', 'wordpress');
define('DB_PASSWORD', 'password');
define('DB_HOST', 'localhost');
define('WP_CONTENT_DIR', '/var/lib/wordpress/wp-content');
?>" | sudo tee /etc/wordpress/config-dev.php > /dev/null
$ echo "CREATE DATABASE wordpress;
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER
ON wordpress.*
TO wordpress@localhost
IDENTIFIED BY 'password';
FLUSH PRIVILEGES;" | sudo tee wp.sql > /dev/null
$ sudo vim /etc/wordpress/config-dev.php
(パスワードを変更)
$ sudo vim wp.sql
(パスワードを変更)
$ cat ~/wp.sql | sudo -u root mysql --defaults-extra-file=/etc/mysql/debian.cnf
■MySQLのチェック
$ echo "select now();" | sudo -u root mysql -p
Enter password:
now()
2014-07-21 02:44:43
$ echo "select Host,User,Super_priv from mysql.user" | sudo -u root mysql -p
Enter password:
Host User Super_priv
localhost root Y
vmwheezy root Y
127.0.0.1 root Y
:1 root Y
localhost debian-sys-maint Y
localhost wordpress N
■リモートから作業する場合
$ echo "GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER
ON wordpress.*
TO wordpress@vmwheezy
IDENTIFIED BY 'password';
FLUSH PRIVILEGES;" | sudo tee wp_remote.sql > /dev/null
$ vim ~/wp_remote.sql
(パスワード変更)
$ cat ~/wp_remote.sql | sudo -u root mysql --defaults-extra-file=/etc/mysql/debian.cnf
$ echo "select Host,User,Super_priv from mysql.user" | sudo -u root mysql -p
Enter password:
Host User Super_priv
localhost root Y
vmwheezy root Y
127.0.0.1 root Y
:1 root Y
localhost debian-sys-maint Y
localhost wordpress N
vmwheezy wordpress N
■接続すると、コンフィグの場所が見つからないらしいので、以下のようにする。
$ w3m -dump -no-proxy http://192.168.152.150/wp/wp-admin/install.php | head -8
Neither /etc/wordpress/config-192.168.152.150.php nor /etc/wordpress/
config-168.152.150.php could be found.
Ensure one of them exists, is readable by the webserver and contains the right
password/username.
$ sudo ln -s /etc/wordpress/config-dev.php /etc/wordpress/config-192.168.152.150.php
$ w3m -dump -no-proxy http://192.168.152.150/wp/wp-admin/install.php | head -8
WordPress
Welcome
Welcome to the famous five minute WordPress installation process! You may want
to browse the ReadMe documentation at your leisure. Otherwise, just fill in the
information below and you’ll be on your way to using the most extendable and
powerful personal publishing platform in the world.
■後はfirefox等のGUIなWebブラウザで設定出来る。
※EMAILは「user@localhost.localdomain」のように「@」の後に「.」も必要という制限がある点に注意。