tima620のゆらぎ

「のlog.txt」を畳み、「の」が崩御し、「のはざま」をはさんだ後に生まれた「のゆらぎ」

初期から雑ログ

読み返しなので順番がごちゃごちゃしてるかも。特にsshの設定回り。
それにしてもあとから書くのすごい大変。作業したらすぐ書かないと。

http://fnya.cocolog-nifty.com/blog/2012/03/centos-6aa8.html
http://morizyun.github.io/blog/sakura-vps-centos63-ssh-setup/
http://www.xn--vps-073b3a72a.com/4.html


とりまアプデ

# yum -y update


パス変

# passwd


ユーザー追加

# useradd hoge -G wheel
# passwd hoge

(ユーザー名hogeじゃないけど便宜上。)


wheelのみsuれる

# vim /etc/pam.d/su

(※引用内は/etc/pam.d/suファイルの編集内容)
コメントアウト外す

auth required pam_wheel.so use_uid
# vim /etc/login.defs

追加

SU_WHEEL_ONLY yes


wheelのみsudoれる

# visudo

コメントアウト外す

%wheel ALL=(ALL) ALL


ssh:rootのログイン禁止

# vim /etc/ssh/sshd_config

変更

PermitRootLogin no
PasswoedAuthentication no


Port変更

# vim /etc/ssh/sshd_config

22から別のに変更

Port 10000

(10000じゃないけど便宜上。)


sshd再起動

# /etc/init.d/sshd restart


http://akabeko.me/blog/2012/04/revps-01-prepare-ssh-key/
http://fnya.cocolog-nifty.com/blog/2012/03/centos-ssh-8291.html
http://www.xn--vps-073b3a72a.com/5.html
http://kazmax.zpp.jp/linux/lin_sshrsa_win.html

公開鍵と秘密鍵をつくる。(何で作ったか忘れたw)
秘密鍵はログイン時に使うよ。
公開鍵(id_rsa.pub)を鯖に置くよ。
確かWinSCPで送った。


.sshディレクトリ作ってパーミッション変更

$ mkdir ~/.ssh/
$ chmod 700 ~/.ssh/


公開鍵をauthorized_keysって名前にして、所有者とパーミッション変更

$ mv id_rsa.pub .ssh/authorized_keys
$ sudo chown hoge:hoge .ssh/authorized_keys
$ chmod 600 .ssh/authorized_keys


sshd再起動

$ sudo /etc/init.d/sshd restart

(この辺文献忘れた)

rvmをインストール

# curl -L https://get.rvm.io | bash -s stable --ruby
# rvm list
# echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"' >> ~/.bash_profile

でターミナル入りなおして


rails入れるよ。

# gem install rails -v 4.0.0
# rails --version


http://www31.atwiki.jp/agehatyou20/pages/30.html
そういえばemacs派だった。

$ sudo yum install emacs
$ sudo yum install anthy-el
$ vi ~/.emacs
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-buffer-file-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-language-environment "Japanese")
(push "/usr/local/share/emacs/site-lisp/anthy/" load-path)
(load-library "anthy")
(setq default-input-method "japanese-anthy")


http://www.obenri.com/_webserver/global_env.html
http://www.obenri.com/_webserver/document_root.html
http://www.server-world.info/query?os=CentOS_6&p=httpd
httpd周りの設定。

# chkconfig httpd on
# emacs /etc/httpd/conf/httpd.conf
--44行あたり--
ServerTokens Prod
--76行あたり--
KeepAlive On
--83行あたり--
MaxKeepAliveRequests 500
--276行あたり--
ServerName www[なんとかかんとか].jp:80
--285行あたり--
UseCanonicalName On
--302行あたり--
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order Deny, Allow
    Deny from all
</Directory>
--333行あたり--
    Options FollowSymLinks
--404行あたり--
DirectoryIndex index.html index.htm
--538行あたり--
ServerSignature Off
--761行あたり--
#AddDefaultCharset UTF-8

再起動

# /etc/init.d/httpd restart

http://www.xn--vps-073b3a72a.com/4.html
そういえば日本人だった

$ sudo emacs /etc/sysconfig/i18n
LANG="ja_JP.UTF-8"
SYSFONT="latarcyrheb-sun16"


phpとか
http://www.xn--vps-073b3a72a.com/10.html
http://dotinstall.com/lessons/basic_sakura_vps/8015

# yum install php-devel php-mysql php-mbstring php-gd php-mcrypt php-xml
# emacs /etc/php.ini
--432行目-
expose_php = Off
--634行目--
error_log = /var/log/php_errors.log
--946行目--
date.timezone = Asia/Tokyo
--1542行目--
mbstring.language = Japanese
--1548行目--
mbstring.internal_encoding = UTF-8
--1552行目--
mbstring.http_input = auto
--1570行目--
mbstring.detect_order = auto

http://www.obenri.com/_lamp/apache_php.html

# emacs /etc/httpd/conf.d/php.conf
--15,16行目--
AddHandler php5-script .php .php4 .php5
AddType text/html .php .php4 .php5

再起動。

# /etc/init.d/httpd restart


mysqlとか
http://www.xn--vps-073b3a72a.com/11.html
http://blog.orangemittoo.net/post/sakuravps_init2/
インストール

# yum install mysql-server

動作確認

# mysql_install_db

設定変更

# emacs /etc/my.cnf
--7行あたりに追加--
default-character-set=utf8
skip-character-set-client-handshake
--末尾に追加--
[mysql]
default-character-set=utf8
[mysqldump]
default-character-set=utf8


再起動

# /etc/init.d mysqld start