Skip to content

Instantly share code, notes, and snippets.

@clicube
Last active December 12, 2015 03:38
Show Gist options
  • Save clicube/4708743 to your computer and use it in GitHub Desktop.
Save clicube/4708743 to your computer and use it in GitHub Desktop.

debian(i386)@さくらVPS(1G) 初期設定メモ

ネームサーバの設定

valuedomainの設定欄に以下を記入

mx @ 10
a * <IP address>

インストール時

rootログインはなし(パスワード未入力)

SSHの設定

/etc/ssh/sshd_config (変更点のみ)

Port xxxx
PermitRootLogin no
PasswordAuthentication no

iptables

http://wiki.debian.org/iptables

に書いてあるとおり設定.(SSHのポート番号部分を sshd_config で設定したものに置き換え)

あれこれインストール

sudo aptitude install zsh vim git ntp gcc make ruby libssl-dev zlib1g-dev libyaml-dev libncurses5-dev libreadline-dev 

.zshrc, .vimrc をローカルからコピー.

echo 'export MAKEOPTS="-j3"' > ~/.zshenv

NTP の設定

参照:

/etc/ntp.conf

server ntp1.sakura.ad.jp iburst
restrict default ignore
restrict -6 default ignore
restrict ntp1.sakura.ad.jp kod nomodify notrap nopeer noquery
#restrict -4 default kod notrap nomodify nopeer noquery
#restrict -6 default kod notrap nomodify nopeer noquery

cronで1日1回チェックするだけでいいので以下の設定をする

sudo insserv -r ntp # 自動起動させない(debian6からは insserv を使う)

/etc/cron.daily/ntpd-q

#!/bin/sh
if [ ! -x /usr/sbin/ntpd ]; then
    exit 0
fi
/usr/sbin/ntpd -qx
/sbin/hwclock --systohc
sudo chmod +x /etc/cron.daily/ntpd-q

if-up時も同期させる

sudo cp /etc/cron.daily/ntpd-q /etc/network/if-up.d/ntpd-q

nginx のインストール

参照: http://blog.eiel.info/blog/2012/07/11/nginx-on-debian/

wget http://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key

/etc/apt/sources.list

deb http://nginx.org/packages/debian/ squeeze nginx
deb-src http://nginx.org/packages/debian/ squeeze nginx

sudo aptitude update
sudo aptitude safe-upgrade
sudo aptitude install nginx
sudo /etc/init.d/nginx status

rbenv のインストール

https://github.com/sstephenson/rbenv/ に書いてあるとおりに

git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zprofile
echo 'eval "$(rbenv init -)"' >> ~/.zprofile

続いて ruby-build

git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

そんで rubyをインストール

rbenv install 1.9.3-p374 --verbose
rbenv install 2.0.0-preview2 --verbose

postfix

postfixをインストール(exim4は削除される)

sudo aptitude install postfix

exim4の残りファイルも削除

sudo aptitude purge exim4 exim4-base exim4-config exim4-daemon-light

不要なやつを削除

参考: http://server-setting.info/debian/first-setting-debian-server.html

sudo aptitude purge nfs-common portmap at

/etc/inittab の仮想コンソール数を減らす

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment