-
サーバ状態
[root@vps ~]# uname -a Linux vps 2.6.18-164.15.1.el5.028stab068.9 #1 SMP Tue Mar 30 18:07:38 MSD 2010 i686 i686 i386 GNU/Linux [root@vps ~]# df -lh Filesystem サイズ 使用 残り 使用% マウント位置 /dev/simfs 10G 553M 9.5G 6% / none 128M 4.0K 128M 1% /dev [root@vps ~]# free -m total used free shared buffers cached Mem: 256 25 230 0 0 0 -/+ buffers/cache: 25 230 Swap: 0 0 0 [root@vps ~]# more /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 26 model name : Intel(R) Xeon(R) CPU L5520 @ 2.27GHz stepping : 5 cpu MHz : 903.093 cache size : 8192 KB physical id : 1 siblings : 8 core id : 0 cpu cores : 4 apicid : 16 fpu : yes fpu_exception : yes cpuid level : 11 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx rdtscp lm constant_tsc ida nonstop_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 s se4_2 popcnt lahf_lm bogomips : 4522.09 clflush size : 64 cache_alignment : 64 address sizes : 40 bits physical, 48 bits virtual power management: [8] [root@vps ~]# ifconfig lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) venet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet addr:127.0.0.1 P-t-P:127.0.0.1 Bcast:0.0.0.0 Mask:255.255.255.255 inet6 addr: 2001:2e8:607:0:2:1:0:47/128 Scope:Global UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1 RX packets:31271 errors:0 dropped:0 overruns:0 frame:0 TX packets:18114 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:40362018 (38.4 MiB) TX bytes:1413532 (1.3 MiB) venet0:0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet addr:xx.xx.xx.xx P-t-P:xx.xx.xx.xx Bcast:xx.xx.xx.xx Mask:255.255.255.255 UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1 [root@vps ~]# cat /proc/user_beancounters Version: 2.5 uid resource held maxheld barrier limit failcnt 32556: kmemsize 3394147 4427407 14372700 14790164 0 lockedpages 0 0 256 256 0 privvmpages 10574 60481 131072 139264 0 shmpages 1281 1327 21504 21504 0 dummy 0 0 0 0 0 numproc 14 23 120 120 0 physpages 5544 40205 0 9223372036854775807 0 vmguarpages 0 0 65536 65536 0 oomguarpages 5544 40205 26112 9223372036854775807 0 numtcpsock 7 10 360 360 0 numflock 1 3 188 206 0 numpty 1 2 8 8 0 numsiginfo 0 2 128 128 0 tcpsndbuf 186400 336376 1720320 2703360 0 tcprcvbuf 114688 432880 1720320 2703360 0 othersockbuf 11640 30632 1126080 2097152 0 dgramrcvbuf 0 8472 262144 262144 0 numothersock 14 18 360 360 0 dcachesize 286395 393441 3409920 3624960 0 numfile 414 736 9312 9312 0 dummy 0 0 0 0 0 dummy 0 0 0 0 0 dummy 0 0 0 0 0 numiptent 33 34 128 128 0
-
ユーザ設定
-
ユーザ追加
[root@vps ~]# useradd -G wheel user
-
パスワード
[root@vps ~]# passwd user Changing password for user user. New UNIX password: Retype new UNIX password: passwd: all authentication tokens updated successfully. [root@vps ~]#
-
-
ssh 設定
-
公開鍵を VPS に転送
$ scp -r .ssh xx.xx.xx.xx:
-
秘密鍵でログオンを確認
$ ssh xx.xx.xx.xx
-
ssh の設定を変更
[root@vps ~]# vi /etc/ssh/sshd_config PermitRootLogin no PubkeyAuthentication yes AuthorizedKeyFile .ssh/authorized_keys PasswordAuthentication no AllowUsers user
-
ssh の設定を適用する
[root@vps ~]# service sshd reload
-
-
sudo 設定
-
sudoers 追加
[root@vps ~]# visudo ## add sudo user and group user ALL=(ALL) ALL %wheel ALL=(ALL) ALL
-
sudo するとエラーが出るので最新にする
-
yum で必要なものを入れる
[root@vps ~]# yum install gcc [root@vps ~]# yum install pam-devel
-
最新の sudo をダウンロード
[root@vps ~]# wget "http://www.sudo.ws/sudo/dist/sudo-1.7.3.tar.gz" [root@vps ~]# tar zxf sudo-1.7.3.tar.gz
-
コンパイルしてインストール
[root@vps ~]# cd sudo-1.7.3 [root@vps sudo-1.7.3]# ./configure [root@vps sudo-1.7.3]# make [root@vps sudo-1.7.3]# make install
-
-
-
不要なサービスを停止
[user@vps]$ sudo /etc/init.d/xinetd stop [user@vps]$ sudo /sbin/chkconfig xinetd off [user@vps]$ sudo /etc/init.d/httpd stop [user@vps]$ sudo /sbin/chkconfig httpd off [user@vps]$ sudo /etc/init.d/saslauthd stop [user@vps]$ sudo /sbin/chkconfig saslauthd off [user@vps]$ sudo /sbin/chkconfig serversman off [user@vps]$ sudo /sbin/chkconfig --list | grep "3:on" crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off network 0:off 1:off 2:on 3:on 4:on 5:on 6:off sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off syslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off
-
CentOS 5.5 にアップグレード
[user@vps]$ sudo yum check-update [user@vps]$ sudo yum update [user@vps]$ sudo /sbin/shutdown -r now [user@vps]$ more /etc/redhat-release CentOS release 5.5 (Final)
-
iptables でファイアウォールを設定
ssh と Tiarra 用のポートのみを許可する [user@vps]$ sudo /etc/init.d/iptables stop [user@vps]$ sudo vi /etc/sysconfig/iptables *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -N MYCHAIN -A MYCHAIN -m state --state ESTABLISHED,RELATED -j ACCEPT -A MYCHAIN -p icmp -j ACCEPT -A MYCHAIN -s 127.0.0.0/8 -d 127.0.0.0/8 -j ACCEPT -A MYCHAIN -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT -A MYCHAIN -m state --state NEW -m tcp -p tcp --dport 6666 -j ACCEPT -A MYCHAIN -j DROP -A INPUT -j MYCHAIN COMMIT [user@vps]$ sudo /etc/init.d/iptables start [user@vps]$ sudo /sbin/iptables -L -nv
-
ドメイン設定
-
無料のドメインを取得
-
設定に反映
[user@vps]$ sudo hostname domain.example.com [user@vps]$ sudo vi /etc/sysconfig/network HOSTNAME="domain.example.com"
-
ddo.jp で取得したドメインは数週間更新がないと抹消されるらしいので cron で更新処理を設定しておく
[user@domain ~]$ vie bin/ddo-update.sh #!/bin/sh wget -O - 'http://free.ddo.jp/dnsupdate.php?dn={HOSTNAME}&ip={IP}&pw={PASSWORD}' [user@domain ~]$ crontab -e 36 8 * * * $HOME/bin/ddo-update.sh > /dev/null 2>&1
-
Last active
June 10, 2018 05:02
-
-
Save tomohiro/474791 to your computer and use it in GitHub Desktop.
ServersMan@vps の初期セットアップ
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment