さくらのVPS セットアップ備忘録 (1) - 登録、初期設定、各種インストール

・登録してすぐ、起動してコンソールを見るも「Kernel panic - not syncing: Attempted to kill init!」となっていて、動かない。
・再起動しても駄目。
・仕方ないのでOS再インストールを実行。
・10数秒程度で完了し、動くようになった。
・以下、とりあえずやった事。


$yum update
$shutdown -r now
$yum list
 
$vi ~/.ssh/authorized_keys
# 公開鍵を追加
$vi /etc/ssh/sshd_config
# パスワード認証をNOに
# ポートを10022に
$/etc/init.d/sshd restart
 
$cat > init-iptables

#!/bin/sh
IF1='eth0'
BCAST1="`/sbin/ifconfig $IF1 | grep 'inet addr' | cut -d : -f 3 | cut -d \ -f 1`"
iptables -F
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -i $IF1 -d $BCAST -j DROP
iptables -A INPUT -d 255.255.255.255 -j DROP
iptables -A INPUT -d 224.0.0.1 -j DROP
iptables -A INPUT -p icmp -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -j ACEPT
iptables -A INPUT -p tcp --dport 10022 -j ACCEPT
iptables -A INPUT -p udp --dport 123 -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
service iptables save
service iptables restart
ip6tables -F
ip6tables -P INPUT DROP
ip6tables -P OUTPUT ACCEPT
ip6tables -P FORWARD DROP
service ip6tables save
service ip6tables restart
$chmod 744 init-iptables
$./init-iptables
 
$vi /etc/sysconfig/i18n
# LANG="ja_JP.UTF-8"
 
$yum install mysql-server
$vi /etc/my.cnf
# charsetをutf8に設定
$chkconfig --list mysqld
$chkconfig mysqld on
$chkconfig --list mysqld
$mysql
# charset反映確認
# rootパスワード設定
# anonymousユーザ削除
$vi /etc/logrotate.d/syslog
# /var/log/mysqld.log 追加
$/etc/init.d/syslog restart
 
$yum install httpd
$yum install httpd-devel
$yum install mod_ssl
$chkconfig httpd on
$chkconfig --list httpd
$/etc/init.d/httpd start
 
$wget "http://............/jdk-6u21-linux-x64-rpm.bin"
$chmod u+x jdk-6u21-linux-x64-rpm.bin
$./jdk-6u21-linux-x64-rpm.bin
$java -version
 
$wget "http://ftp.riken.jp/net/apache//tomcat/tomcat-6/v6.0.29/bin/apache-tomcat-6.0.29.tar.gz"
$tar zxvf apache-tomcat-6.0.29.tar.gz
$mv apache-tomcat-6.0.29 /usr/local/tomcat
$useradd tomcat -d /usr/local/tomcat
$chown -R tomcat:tomcat /usr/local/tomcat
$vi /etc/profile
# クラスパス等を設定
$source /etc/profile
$vi /usr/local/tomcat/conf/server.xml
$mv /usr/local/tomcat/logs/ /var/log/tomcat
$ln -s /var/log/tomcat/ /usr/local/tomcat/logs
$vi /etc/logrotate.d/tomcat
$logrotate -d /etc/logrotate.d/tomcat
$/etc/init.d/syslog restart

Tomcatの設定途中だけど、とりあえずここまで。


参考情報:oss-d.net - このウェブサイトは販売用です! - サーバ 構築 オープンソース インストール バックアップ 仮想 構成 マシン リソースおよび情報