さくらのVPS 1G-gitによる設定管理
・ gitをインストール
$ sudo yum install git $ cd /etc $ sudo git init $ sudo git add . $ sudo git commit -a -m 'Initial commit' $ git status
・ユーザ名とメールアドレスを設定する
$ git config --global user.name "Your Name" $ git config --global user.email you@example.com
さくらのVPS 1G-RubyとRuby on Railsのインストール
rvmのインストール
rvmをインストールします.
$ sudo bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer) Cloning into rvm... remote: Counting objects: 5920, done. remote: Compressing objects: 100% (2846/2846), done. remote: Total 5920 (delta 3889), reused 4161 (delta 2311) Receiving objects: 100% (5920/5920), 1.96 MiB | 212 KiB/s, done. Resolving deltas: 100% (3889/3889), done. RVM: Shell scripts enabling management of multiple ruby environments. RTFM: https://rvm.beginrescueend.com/ HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net) Installing RVM to /usr/local/rvm/ Correct permissions for base binaries in /usr/local/rvm/bin... Copying manpages into place. Creating RVM system user group 'rvm' Recording config files for rubies. root, If you have any questions, issues and/or ideas for improvement please fork the project and issue a pull request. If you wish to disable the project .rvmrc file functionality, set rvm_project_rvmrc=0 in either /etc/rvmrc or ~/.rvmrc. NOTE: To Multi-User installers, please do NOT forget to add your users to the 'rvm' group. The installer no longer auto-adds root or users to the rvm group. Admins must do this. Also, please note that group memberships are ONLY evaluated at login time. This means that users must log out then back in before group membership takes effect! Thank you for using RVM! I sincerely hope that RVM helps to make your life easier and more enjoyable!!! ~Wayne SYSTEM NOTES: If you do not wish to enable reading of per-project .rvmrc files, simply set: export rvm_project_rvmrc=0 within either your /etc/rvmrc or $HOME/.rvmrc file, then log out and back in. In case your shell exits on entering directory with freshly checked out sources you should update .rvmrc file, and replace any `exit ` with `return `. You _must_ read 'rvm requirements' for additional OS specific requirements for various rubies, and native-extension gems. Expect failures until those are met! For screen users, please do not forget to read https://rvm.beginrescueend.com/workflow/scre en/. You will need to add 'shell -/bin/bash' to your $HOME/.screenrc to properly load RVM. Installation of RVM to /usr/local/rvm/ is complete. Requirements for Linux ( CentOS release 5.7 (Final) ) NOTE: 'ruby' represents Matz's Ruby Interpreter (MRI) (1.8.X, 1.9.X) This is the *original* / standard Ruby Language Interpreter 'ree' represents Ruby Enterprise Edition 'rbx' represents Rubinius bash >= 4.1 required curl is required git is required (>= 1.7 recommended) patch is required (for ree and some ruby-head's). To install rbx and/or Ruby 1.9 head (MRI) (eg. 1.9.2-head), then you must install and use rvm 1.8.7 first. NOTE: To all Multi-User installers - DO NOT forget to add your users to the 'rvm' group. The installer does not auto-add any users to the rvm group. Admins must do this. Group memberships are ONLY evaluated at login time. Log them out, then back in. Additional Dependencies: # For Ruby / Ruby HEAD (MRI, Rubinius, & REE), install the following: ruby: yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel ## NOTE: For centos >= 5.4 iconv-devel is provided by glibc # For JRuby, install the following: jruby: yum install -y java
グループと環境変数
・rvmグループに,自分のアカウントを追加する.
$ vigr
・一度logoutして,再度loginすると,環境変数とグループが設定される.
$ echo $PATH /usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/rvm/bin:/home/yc/bin $ groups ... wheel rvm
関連するライブラリのインストール
$ sudo yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel
rubyのインストール
$ rvm install 1.9.3 Installing Ruby from source to: /usr/local/rvm/rubies/ruby-1.9.3-p0, this may take a while depending on your cpu(s)... ruby-1.9.3-p0 - #fetching ruby-1.9.3-p0 - #extracting ruby-1.9.3-p0 to /usr/local/rvm/src/ruby-1.9.3-p0 ruby-1.9.3-p0 - #extracted to /usr/local/rvm/src/ruby-1.9.3-p0 Fetching yaml-0.1.4.tar.gz to /usr/local/rvm/archives Extracting yaml-0.1.4.tar.gz to /usr/local/rvm/src Prepare yaml in /usr/local/rvm/src/yaml-0.1.4. Configuring yaml in /usr/local/rvm/src/yaml-0.1.4. Compiling yaml in /usr/local/rvm/src/yaml-0.1.4. Installing yaml to /usr/local/rvm/usr ruby-1.9.3-p0 - #configuring ruby-1.9.3-p0 - #compiling ruby-1.9.3-p0 - #installing Removing old Rubygems files... Installing rubygems-1.8.10 for ruby-1.9.3-p0 ... Installation of rubygems completed successfully. ruby-1.9.3-p0 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake). ruby-1.9.3-p0 - #importing default gemsets (/usr/local/rvm/gemsets/) Install of ruby-1.9.3-p0 - #complete
・使用するrubyのバージョンを設定する
$ rvm list rvm rubies ruby-1.9.3-p0 [ x86_64 ] $ rvm use 1.9.3 --default Using /usr/local/rvm/gems/ruby-1.9.3-p0 $ ruby -v ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux] $ type ruby ruby is hashed (/usr/local/rvm/rubies/ruby-1.9.3-p0/bin/ruby)
・設定変更の確認とコミット
$ cd /etc $ sudo git status # On branch master # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: group # modified: group- # modified: group.OLD # modified: gshadow # modified: gshadow- # modified: gshadow.OLD # modified: ld.so.cache # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # profile.d/rvm.sh # rvmrc # profile.d/krb5-devel.csh # profile.d/krb5-devel.sh no changes added to commit (use "git add" and/or "git commit -a") $ sudo git add . $ sudo git commit -a -m 'Installed ruby with rvm'
Ruby on Railsのインストール
gem install rails
sqlite3のインストール
ソースをダウンロードしてインストールする.
※ yum install sqlite-develではsqliteのgemがインストールできなかった.
$ wget http://www.sqlite.org/sqlite-autoconf-3070900.tar.gz $ tar zxvf sqlite-autoconf-3070900.tar.gz $ cd sqlite-autoconf-3070900 $ ./configure && make $ sudo make install make[1]: Entering directory `/home/yc/src/sqlite-autoconf-3070900' test -z "/usr/local/lib" || /bin/mkdir -p "/usr/local/lib" /bin/sh ./libtool --mode=install /usr/bin/install -c libsqlite3.la '/usr/local/lib' /usr/bin/install -c .libs/libsqlite3.so.0.8.6 /usr/local/lib/libsqlite3.so.0.8.6 (cd /usr/local/lib && { ln -s -f libsqlite3.so.0.8.6 libsqlite3.so.0 || { rm -f libsqlite3.so.0 && ln -s libsqlite3.so.0.8.6 libsqlite3.so.0; }; }) (cd /usr/local/lib && { ln -s -f libsqlite3.so.0.8.6 libsqlite3.so || { rm -f libsqlite3.so && ln -s libsqlite3.so.0.8.6 libsqlite3.so; }; }) /usr/bin/install -c .libs/libsqlite3.lai /usr/local/lib/libsqlite3.la /usr/bin/install -c .libs/libsqlite3.a /usr/local/lib/libsqlite3.a chmod 644 /usr/local/lib/libsqlite3.a ranlib /usr/local/lib/libsqlite3.a PATH="$PATH:/sbin" ldconfig -n /usr/local/lib ---------------------------------------------------------------------- Libraries have been installed in: /usr/local/lib If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-Wl,--rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- test -z "/usr/local/bin" || /bin/mkdir -p "/usr/local/bin" /bin/sh ./libtool --mode=install /usr/bin/install -c sqlite3 '/usr/local/bin' /usr/bin/install -c .libs/sqlite3 /usr/local/bin/sqlite3 test -z "/usr/local/include" || /bin/mkdir -p "/usr/local/include" /usr/bin/install -c -m 644 sqlite3.h sqlite3ext.h '/usr/local/include' test -z "/usr/local/share/man/man1" || /bin/mkdir -p "/usr/local/share/man/man1" /usr/bin/install -c -m 644 sqlite3.1 '/usr/local/share/man/man1' test -z "/usr/local/lib/pkgconfig" || /bin/mkdir -p "/usr/local/lib/pkgconfig" /usr/bin/install -c -m 644 sqlite3.pc '/usr/local/lib/pkgconfig' make[1]: Leaving directory `/home/yc/src/sqlite-autoconf-3070900'
libの設定.
$ sudo vi /etc/ld.so.conf $ cat /etc/ld.so.conf include ld.so.conf.d/*.conf /usr/local/lib $ sudo /sbin/ldconfig
さくらのVPS 1G-Node.jsのインストール
Node.jsのインストール
/usr/local/nvmへのインストール
$ sudo /usr/sbin/groupadd nvm $ sudo /usr/sbin/vigr $ sudo env GIT_SSL_NO_VERIFY=true git clone https://github.com/creationix/nvm.git /usr/local/nvm $ sudo chmod 6775 /usr/local/nvm $ sudo chown root:nvm /usr/local/nvm $ vi /etc/profile.d/nvm.sh # . /usr/local/nvm/nvm.sh $ nvm install v0.6.3 $ nvm alias default 0.6
さくらのVPS 1G-ImageMagickのインストール
$ wget http://www.imagemagick.org/download/linux/CentOS/x86_64/ImageMagick-6.7.3-8.x86_64.rpm $ wget http://www.imagemagick.org/download/linux/CentOS/x86_64/ImageMagick-devel-6.7.3-8.x86_64.rpm $ sudo yum -y localinstall ImageMagick-6.7.3-8.x86_64.rpm ImageMagick-devel-6.7.3-8.x86_64.rpm --nogpgcheck
さくらのVPS 1Gの設定-SSHの設定
SSH公開鍵を用い,ネットワーク経由でログインできるようにします.
※←はオプショナルです.
・さくらの「VPSコントロールパネル」から,指定されたrootパスワードでログインする
・OSのアップグレードをする(yum upgrade)
・自分のユーザアカウントを作成する(useraddコマンド)
・パスワードを設定する(passwdコマンド)
・wheelにsudoでのコマンド実行を許可する(visudoコマンド)
・自分をwheelに追加する(vigrコマンド)
・自分のアカウントに切り替える(su -コマンド)
※sudoをテストする
※SSH公開鍵を生成する(ssh-keygenコマンド)
・自分が持っているSSHの公開鍵をsftpでサーバにアップロードする.
・.ssh/authorized_keysに公開鍵を追加する
$ cat id_rsa.pub >> .ssh/authorized_keys $ chmod 600 .ssh/authorized_keys
以上です.
さくらのVPS 1G-rpmforgeの設定
RPMForgeを設定して,おまけ(additionalな)パッケージを使えるようにします.
$ yum search git $ less /etc/redhat-release $ uname -i $ wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm $ sudo rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt $ sudo rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm $ yum search git
参考