インストール済みソフトの更新
yum update
viの便利版、vimをインストール
yum install vim-enhanced
コンソールを日本語化
vim /etc/sysconfig/i18n
(変更前)LANG="C"
(変更後)LANG="ja_JP.UTF-8"
Apache、PHP、MySQL、phpMyAdmin をインストール
yum install httpd-devel php-devel php-pear mysql-server phpmyadmin
Apache(httpd) を自動起動するよう設定
chkconfig httpd on
MySQL(mysqld) を自動起動するよう設定
chkconfig mysqld on
Apacheの設定
最低限変更すべき設定
※mydomain.comは、ご自分のドメインと読み替えてください。
vim /etc/httpd/conf/httpd.conf
(変更前)
ServerName *:80
(変更後)
ServerName mydomain.com:80
(変更前)
<Directory /> Options FollowSymLinks AllowOverride None </Directory>
(変更後)
<Directory /> Options FollowSymLinks # AllowOverride None AllowOverride All </Directory>
名前ベースのバーチャルホスト(subdomain.mydomain.com)を使えるよう設定
vim /etc/httpd/conf.d/vhost.conf
NameVirtualHost *:80 # DocumentRoot <VirtualHost *:80> ServerName mydomain.com DocumentRoot /var/www/vhosts/mydomain.com/html ServerAdmin info@mydomain.com ErrorLog /var/www/vhosts/mydomain.com/logs/error.log TransferLog /var/www/vhosts/mydomain.com/logs/access.log </VirtualHost> # VirtualHost <VirtualHost *:80> ServerName subdomain.mydomain.com DocumentRoot /var/www/vhosts/subdomain.mydomain.com/html ServerAdmin subdomain@mydomain.com ErrorLog /var/www/vhosts/subdomain.mydomain.com/logs/error.log TransferLog /var/www/vhosts/subdomain.mydomain.com/logs/access.log </VirtualHost>
※公開ファイルのアップ先は、/var/www/vhosts/mydomain.com/html になります。
MySQL の設定
MySQL(mysqld) の初期設定
/usr/bin/mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, 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): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL 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 MySQL installation has an anonymous user, allowing anyone to log into MySQL 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] y ... 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] y ... Success! By default, MySQL 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] y - 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] y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL!
phpMyAdmin の設定
次のサンプルURLのようにアクセスし、設定を行います。
http://mydomain.com/phpmyadmin/setup
設定後は、
http://mydomain.com/phpmyadmin
でアクセスできます。
※FTPサーバーについては、vsftpdをテスト的に入れましたが、現在SFTP(SSH)でファイルのアップダウンを行なっています。
※メールサーバーについては、GoogleApps(Gmail)を利用しているため設定していません。