星野/VPS
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
[[星野]]
*目次 [#t5890db1]
#contents
*目的 [#kb04c124]
-停電で自鯖動かせないから。
-VPS(Virtual Private Server)が格安で提供されているご時勢。
-WordPressが動けば、僕のやりたいことはできるかなと。
--ssh
--iptables
--apache
--php
--mysql
--postfix
--こんなもんかな?
-そもそも、ml115はうるさい。
*契約内容 [#a37eba62]
-ServersMan@VPS Entryプラン
-490円/月 2ヶ月無料らしいが。
-契約開始2011.3.30
-http://dream.jp/vps/
-CentOS 32bitを選んだ。なぜ64じゃないかって?メモリが512Mだしいらんやろw
[root@dti-vps-srv35 ~]# cat /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.095
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 sse4_2 popcnt lahf_lm
bogomips : 4522.10
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management: [8]
[root@dti-vps-srv35 ~]# free
total used free shared buffers cached
Mem: 786432 34660 751772 0 0 0
-/+ buffers/cache: 34660 751772
Swap: 0 0 0
[root@dti-vps-srv35 ~]# cat /etc/redhat-release
CentOS release 5.4 (Final)
[root@dti-vps-srv35 ~]# uname -a
Linux dti-vps-srv35 2.6.18-194.3.1.el5.028stab069.6 #1 SMP Wed May 26 18:31:05 MSD 2010 i686 i686 i386 GNU/Linux
*設定など [#n381f5c8]
**2011.3.30 初期設定 [#y5653361]
***ssh接続 [#a6cb87f9]
--契約したときにくるメールに【VPSサーバー情報】が送られてくる
---IPv4、IPv6、rootパスワード
--teratermで接続
---ポートは3843だった。最初つなげなかった・・・w
***rootパスワード変更 [#a0af674f]
$passwd
***管理ユーザ作成 & visudoの設定 [#yad510cb]
$ useradd -G wheel hoge
$ passwd hoge
$ visudo
%wheel ALL=(ALL) ALL この行のコメントアウトをはずす。
-rootになれるアカウント規制、PAM設定
--wheelグループに所属していないと、suできない
$ vi /etc/pam.d/su
# Uncomment the following line to require a user to be in the "wheel" group.
auth required pam_wheel.so use_uid この行のコメントアウトをはずす。
***sshでrootログイン禁止 [#ecb90a05]
$ sudo vi /etc/sshd/sshd_config
PermitRootLogin no
$ /etc/init.d/sshd restart
***ssh接続を鍵認証のみにするのはパス。 [#g0ec69ff]
***不要サービスオフ [#bdc5bfb8]
[root@dti-vps-srv35 ~]# chkconfig --list | grep 3:on
ajaxterm 0:off 1:off 2:on 3:on 4:on 5:on 6:off
crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
httpd 0:off 1:off 2:off 3:on 4:off 5:off 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
saslauthd 0:off 1:off 2:off 3:on 4:off 5:off 6:off
sendmail 0:off 1:off 2:on 3:on 4:on 5:on 6:off
serversman 0:off 1:off 2:off 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
xinetd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
-どれが不要よ?w
--sendmailじゃなくてpostfix使いたい。
--serversmanはWebDAVでオンラインストレージにするときに必要っぽい。(けどよくわからん。)
-とりあえず、そのまま。
***アップデート [#pf032724]
$ yum update
**2011.3.31 初期設定その2 [#bacf7612]
***iptables [#nb735cf4]
-許可するもの
--localhostからの接続, ping, SSH, HTTP, SMTP(later), FTP(later)
#!/bin/sh
# Reset rules
iptables -F
iptables -X
# Set policy
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
# ping
iptables -A INPUT -p icmp -j ACCEPT
# local
iptables -A INPUT -i lo -j ACCEPT
# ssh
iptables -A INPUT -p tcp --dport 3843 -j ACCEPT
# http
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
# Accept packets after connecting session
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
$ ./setiptables.sh
$ /etc/init.d/iptables save
$ /etc/init.d/iptables restart
***httpd設定 [#e5a1d7a3]
-実行するユーザ変更
$ vi /etc/httpd/conf/httpd.conf
# User daemon
# Group daemon
User apache
Group apache
-インデックス表示を禁止
$ vi /etc/httpd/conf/httpd.conf
<Directory "/var/www/html">
#Options Indexes FollowSymLinks
Options -Indexes FollowSymLinks
</Directory>
-ルートディレクトリ変更
--/srv/www に
**2011.4.3 PHP&MySQL設定 [#k1cf8950]
***PHP [#uc41cac3]
-phpの最新バージョン
--PHP 5.3.6
-yumでインスコできるバージョン
--PHP 5.1.6
-どうしたら?
***yumのリポジトリ追加 [#zbfbce7c]
-EPELとREMIを追加すると、新しいのが使えるようだ。
--http://blog.phpbeginners.net/?p=248
$ wget http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
$ wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
$ rpm -ivh epel-release-5-4.noarch.rpm
$ rpm -ivh remi-release-5.rpm
$ yum --enablerepo=remi,epel update
-----いろいろ省略--------
Updated:
remi-release.noarch 0:5-8.el5.remi
$ yum --enablerepo=remi,epel info php
Version : 5.3.6
-これでできるのか。
-remiを有効にしておく
$ vi /etc/yum.repos.d/remi.repo
#enabled=0 comment out
enabled=1
***気を取り直してphpインスコ [#obfd4853]
-http://temog.info/archives/vps/serversmanvps-php5-3-2-mysql5-1-45-%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB.html
$ yum install php php-devel php-mbstring php-mysql php-gd php-mcrypt
--関連パッケージがよくわからん。
Installed:
php.i386 0:5.3.6-1.el5.remi php-devel.i386 0:5.3.6-1.el5.remi
php-gd.i386 0:5.3.6-1.el5.remi php-mbstring.i386 0:5.3.6-1.el5.remi
php-mcrypt.i386 0:5.3.6-1.el5.remi php-mysql.i386 0:5.3.6-1.el5.remi
Dependency Installed:
autoconf.noarch 0:2.59-12 automake.noarch 0:1.9.6-2.3.el5
freetype.i386 0:2.2.1-28.el5_5.1 gmp.i386 0:4.1.4-10.el5
imake.i386 0:1.0.2-3 libICE.i386 0:1.0.1-2.1
libSM.i386 0:1.0.1-3.1 libX11.i386 0:1.0.3-11.el5
libXau.i386 0:1.0.1-3.1 libXaw.i386 0:1.0.2-8.1
libXdmcp.i386 0:1.0.1-2.1 libXext.i386 0:1.0.1-2.1
libXmu.i386 0:1.0.2-5 libXpm.i386 0:3.5.5-3
libXt.i386 0:1.0.2-3.2.el5 libedit.i386 0:2.11-2.20080712cvs.el5
libmcrypt.i386 0:2.5.8-4.el5.centos libtool-ltdl.i386 0:1.5.22-7.el5_4
mysql-libs.i386 0:5.1.56-1.el5.remi php-cli.i386 0:5.3.6-1.el5.remi
php-common.i386 0:5.3.6-1.el5.remi php-pdo.i386 0:5.3.6-1.el5.remi
t1lib.i386 0:5.1.1-7.el5 xorg-x11-filesystem.noarch 0:7.1-2.fc6
Complete!
-ヴァージョンとかモジュールとか確認するコマンド
$ php -v
$ php -m
***MySQLインスコ [#laa54c48]
-Version:
5.1.56
-yum
$ yum install -y mysql-server
-オプションyはyesを想定するらしい。
Installed:
mysql-server.i386 0:5.1.56-1.el5.remi
Dependency Installed:
mysql.i386 0:5.1.56-1.el5.remi mysqlclient15.i386 0:5.0.67-1.el5.remi
perl-DBD-MySQL.i386 0:3.0007-2.el5 perl-DBI.i386 0:1.52-2.el5
Complete!
***MySQL設定 [#e12060de]
-/etc/my.cnf
--それぞれ追加。
[mysql] #new
default-character-set=utf8 #new
[mysqld]
character-set-server=utf8 #new
-起動
$ /etc/init.d/mysqld start
-mysqlのユーザを整理
--rootで入る
$ mysql -u root
--mysql.userデータベースを見ると、ユーザ名のないホストがあるのでそれ削除
mysql> select user,host,password from mysql.user;
+------+-------------------+----------+
| user | host | password |
+------+-------------------+----------+
| root | localhost | |
| root | vps.brightstar.jp | |
| root | 127.0.0.1 | |
| | localhost | |
| | vps.brightstar.jp | |
+------+-------------------+----------+
5 rows in set (0.00 sec)
mysql> delete from mysql.user where user = '';
Query OK, 2 rows affected (0.00 sec)
mysql> select user,host,password from mysql.user;
+------+-------------------+----------+
| user | host | password |
+------+-------------------+----------+
| root | localhost | |
| root | dti-vps-srv37 | |
| root | 127.0.0.1 | |
+------+-------------------+----------+
3 rows in set (0.00 sec)
--rootのパスワード設定
mysql> update mysql.user set password=password('パスワード') where user = 'root';
--設定完了作業?
---mysql データベースの権限テーブルから権限を再読み込みする。 とあるが・・・
mysql> flush preveliges
--WordPress用のDBを作成
mysql> create database wordpress;
--作ったDBにアクセスするユーザの作成
mysql> grant all privileges on wordpress.* to wordpress@localhost identified by 'パスワード';
--参考サイト
---http://temog.info/archives/vps/serversmanvps-php5-3-2-mysql5-1-45-%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB.html
----
*コメント [#kc5a5781]
#comment
終了行:
[[星野]]
*目次 [#t5890db1]
#contents
*目的 [#kb04c124]
-停電で自鯖動かせないから。
-VPS(Virtual Private Server)が格安で提供されているご時勢。
-WordPressが動けば、僕のやりたいことはできるかなと。
--ssh
--iptables
--apache
--php
--mysql
--postfix
--こんなもんかな?
-そもそも、ml115はうるさい。
*契約内容 [#a37eba62]
-ServersMan@VPS Entryプラン
-490円/月 2ヶ月無料らしいが。
-契約開始2011.3.30
-http://dream.jp/vps/
-CentOS 32bitを選んだ。なぜ64じゃないかって?メモリが512Mだしいらんやろw
[root@dti-vps-srv35 ~]# cat /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.095
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 sse4_2 popcnt lahf_lm
bogomips : 4522.10
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management: [8]
[root@dti-vps-srv35 ~]# free
total used free shared buffers cached
Mem: 786432 34660 751772 0 0 0
-/+ buffers/cache: 34660 751772
Swap: 0 0 0
[root@dti-vps-srv35 ~]# cat /etc/redhat-release
CentOS release 5.4 (Final)
[root@dti-vps-srv35 ~]# uname -a
Linux dti-vps-srv35 2.6.18-194.3.1.el5.028stab069.6 #1 SMP Wed May 26 18:31:05 MSD 2010 i686 i686 i386 GNU/Linux
*設定など [#n381f5c8]
**2011.3.30 初期設定 [#y5653361]
***ssh接続 [#a6cb87f9]
--契約したときにくるメールに【VPSサーバー情報】が送られてくる
---IPv4、IPv6、rootパスワード
--teratermで接続
---ポートは3843だった。最初つなげなかった・・・w
***rootパスワード変更 [#a0af674f]
$passwd
***管理ユーザ作成 & visudoの設定 [#yad510cb]
$ useradd -G wheel hoge
$ passwd hoge
$ visudo
%wheel ALL=(ALL) ALL この行のコメントアウトをはずす。
-rootになれるアカウント規制、PAM設定
--wheelグループに所属していないと、suできない
$ vi /etc/pam.d/su
# Uncomment the following line to require a user to be in the "wheel" group.
auth required pam_wheel.so use_uid この行のコメントアウトをはずす。
***sshでrootログイン禁止 [#ecb90a05]
$ sudo vi /etc/sshd/sshd_config
PermitRootLogin no
$ /etc/init.d/sshd restart
***ssh接続を鍵認証のみにするのはパス。 [#g0ec69ff]
***不要サービスオフ [#bdc5bfb8]
[root@dti-vps-srv35 ~]# chkconfig --list | grep 3:on
ajaxterm 0:off 1:off 2:on 3:on 4:on 5:on 6:off
crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
httpd 0:off 1:off 2:off 3:on 4:off 5:off 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
saslauthd 0:off 1:off 2:off 3:on 4:off 5:off 6:off
sendmail 0:off 1:off 2:on 3:on 4:on 5:on 6:off
serversman 0:off 1:off 2:off 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
xinetd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
-どれが不要よ?w
--sendmailじゃなくてpostfix使いたい。
--serversmanはWebDAVでオンラインストレージにするときに必要っぽい。(けどよくわからん。)
-とりあえず、そのまま。
***アップデート [#pf032724]
$ yum update
**2011.3.31 初期設定その2 [#bacf7612]
***iptables [#nb735cf4]
-許可するもの
--localhostからの接続, ping, SSH, HTTP, SMTP(later), FTP(later)
#!/bin/sh
# Reset rules
iptables -F
iptables -X
# Set policy
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
# ping
iptables -A INPUT -p icmp -j ACCEPT
# local
iptables -A INPUT -i lo -j ACCEPT
# ssh
iptables -A INPUT -p tcp --dport 3843 -j ACCEPT
# http
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
# Accept packets after connecting session
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
$ ./setiptables.sh
$ /etc/init.d/iptables save
$ /etc/init.d/iptables restart
***httpd設定 [#e5a1d7a3]
-実行するユーザ変更
$ vi /etc/httpd/conf/httpd.conf
# User daemon
# Group daemon
User apache
Group apache
-インデックス表示を禁止
$ vi /etc/httpd/conf/httpd.conf
<Directory "/var/www/html">
#Options Indexes FollowSymLinks
Options -Indexes FollowSymLinks
</Directory>
-ルートディレクトリ変更
--/srv/www に
**2011.4.3 PHP&MySQL設定 [#k1cf8950]
***PHP [#uc41cac3]
-phpの最新バージョン
--PHP 5.3.6
-yumでインスコできるバージョン
--PHP 5.1.6
-どうしたら?
***yumのリポジトリ追加 [#zbfbce7c]
-EPELとREMIを追加すると、新しいのが使えるようだ。
--http://blog.phpbeginners.net/?p=248
$ wget http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
$ wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
$ rpm -ivh epel-release-5-4.noarch.rpm
$ rpm -ivh remi-release-5.rpm
$ yum --enablerepo=remi,epel update
-----いろいろ省略--------
Updated:
remi-release.noarch 0:5-8.el5.remi
$ yum --enablerepo=remi,epel info php
Version : 5.3.6
-これでできるのか。
-remiを有効にしておく
$ vi /etc/yum.repos.d/remi.repo
#enabled=0 comment out
enabled=1
***気を取り直してphpインスコ [#obfd4853]
-http://temog.info/archives/vps/serversmanvps-php5-3-2-mysql5-1-45-%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB.html
$ yum install php php-devel php-mbstring php-mysql php-gd php-mcrypt
--関連パッケージがよくわからん。
Installed:
php.i386 0:5.3.6-1.el5.remi php-devel.i386 0:5.3.6-1.el5.remi
php-gd.i386 0:5.3.6-1.el5.remi php-mbstring.i386 0:5.3.6-1.el5.remi
php-mcrypt.i386 0:5.3.6-1.el5.remi php-mysql.i386 0:5.3.6-1.el5.remi
Dependency Installed:
autoconf.noarch 0:2.59-12 automake.noarch 0:1.9.6-2.3.el5
freetype.i386 0:2.2.1-28.el5_5.1 gmp.i386 0:4.1.4-10.el5
imake.i386 0:1.0.2-3 libICE.i386 0:1.0.1-2.1
libSM.i386 0:1.0.1-3.1 libX11.i386 0:1.0.3-11.el5
libXau.i386 0:1.0.1-3.1 libXaw.i386 0:1.0.2-8.1
libXdmcp.i386 0:1.0.1-2.1 libXext.i386 0:1.0.1-2.1
libXmu.i386 0:1.0.2-5 libXpm.i386 0:3.5.5-3
libXt.i386 0:1.0.2-3.2.el5 libedit.i386 0:2.11-2.20080712cvs.el5
libmcrypt.i386 0:2.5.8-4.el5.centos libtool-ltdl.i386 0:1.5.22-7.el5_4
mysql-libs.i386 0:5.1.56-1.el5.remi php-cli.i386 0:5.3.6-1.el5.remi
php-common.i386 0:5.3.6-1.el5.remi php-pdo.i386 0:5.3.6-1.el5.remi
t1lib.i386 0:5.1.1-7.el5 xorg-x11-filesystem.noarch 0:7.1-2.fc6
Complete!
-ヴァージョンとかモジュールとか確認するコマンド
$ php -v
$ php -m
***MySQLインスコ [#laa54c48]
-Version:
5.1.56
-yum
$ yum install -y mysql-server
-オプションyはyesを想定するらしい。
Installed:
mysql-server.i386 0:5.1.56-1.el5.remi
Dependency Installed:
mysql.i386 0:5.1.56-1.el5.remi mysqlclient15.i386 0:5.0.67-1.el5.remi
perl-DBD-MySQL.i386 0:3.0007-2.el5 perl-DBI.i386 0:1.52-2.el5
Complete!
***MySQL設定 [#e12060de]
-/etc/my.cnf
--それぞれ追加。
[mysql] #new
default-character-set=utf8 #new
[mysqld]
character-set-server=utf8 #new
-起動
$ /etc/init.d/mysqld start
-mysqlのユーザを整理
--rootで入る
$ mysql -u root
--mysql.userデータベースを見ると、ユーザ名のないホストがあるのでそれ削除
mysql> select user,host,password from mysql.user;
+------+-------------------+----------+
| user | host | password |
+------+-------------------+----------+
| root | localhost | |
| root | vps.brightstar.jp | |
| root | 127.0.0.1 | |
| | localhost | |
| | vps.brightstar.jp | |
+------+-------------------+----------+
5 rows in set (0.00 sec)
mysql> delete from mysql.user where user = '';
Query OK, 2 rows affected (0.00 sec)
mysql> select user,host,password from mysql.user;
+------+-------------------+----------+
| user | host | password |
+------+-------------------+----------+
| root | localhost | |
| root | dti-vps-srv37 | |
| root | 127.0.0.1 | |
+------+-------------------+----------+
3 rows in set (0.00 sec)
--rootのパスワード設定
mysql> update mysql.user set password=password('パスワード') where user = 'root';
--設定完了作業?
---mysql データベースの権限テーブルから権限を再読み込みする。 とあるが・・・
mysql> flush preveliges
--WordPress用のDBを作成
mysql> create database wordpress;
--作ったDBにアクセスするユーザの作成
mysql> grant all privileges on wordpress.* to wordpress@localhost identified by 'パスワード';
--参考サイト
---http://temog.info/archives/vps/serversmanvps-php5-3-2-mysql5-1-45-%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB.html
----
*コメント [#kc5a5781]
#comment
ページ名: