さくらのVPS
さくらのVPS コントロールパネル
月額980円
CentOS
HDD: 20GB
memory: 512MB
IPv4 x1
https://secure.sakura.ad.jp/vpscontrol/main/ http://support.sakura.ad.jp/support/vps/tips_ossetup.shtml http://vps.sakura.ad.jp/作業履歴
yumパッケージ インストール
yum -y update yum -y install httpd httpd-devel yum -y install mysql mysql-server mysql-devel yum -y install php php-mysql php-devel php-mcrypt php-mbstring yum -y install openssl-devel readline-devel zlib-devel yum -y install apr apr-devel yum -y install subversion mod_dav_svn yum -y install subversion mod_dav_svn yum -y install postfix echo $PATH PATH=$PATH:/usr/local/binRuby関連パッケージをまとめてインストール (Ruby, gem, rake, rails, passenger)
wget http://rubyforge.org/frs/download.php/71096/ruby-enterprise-1.8.7-2010.02.tar.gz tar xzvf ruby-enterprise-1.8.7-2010.02.tar.gz ./ruby-enterprise-1.8.7-2010/installer (インストール先の入力) Target directory ["/opt/ruby-enterprise-1.8.7-2009.10/"] : /usr/local/ と入力
passenger-install-apache2-module LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15/ext/apache2/mod_passenger.so PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15 PassengerRuby /usr/local/bin/ruby vi /etc/httpd/conf.d/passenger.conf # /etc/init.d/httpd start # /sbin/chkconfig httpd on
phpMyAdmin インストール
phpMyAdmin3.3.6はPHP5.2以上が必要
vi /etc/yum.repos.d/utterramblings.repo [utterramblings] name=Jason's Utter Ramblings Repo baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/ enabled=1 gpgcheck=1 gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka 後は、アップデートすれば5.2のPHP環境になる yum update php* -y wget http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.3.6/phpMyAdmin-3.3.6-all-languages.zip?r=http%3A%2F%2Fwww.phpmyadmin.net%2Fhome_page%2Findex.php&ts=1283851960&use_mirror=jaist mv phpmyadmin /var/www/html/phpmyadmin cd /var/www/html/phpmyadmin cp config.sample.inc.php config.inc.php vi config.inc.php $cfg['blowfish_secret'] = '***********'; (適当なスレーズを入力) grant all on *.* to owner identified by '******'; grant select,insert,delete,update,create,drop,file,alter,index on *.* to db_user identified by '******';
svn checkout http://redmine.rubyforge.org/svn/trunk/ redmine mv redmine /var/www/ cd /var/www/redmine cd config/ cp database.yml.example database.yml vi database.yml cp email.yml.example email.yml vi email.yml gem install -v=2.3.5 rails gem uninstall rails rake config/initializers/session_store.rb rake db:migrate RAILS_ENV=production(redemineデータベースにテーブルが生成される)
cd /var/www/redmine/ # cp dispatch.cgi.example dispatch.cgi
#ruby -v ruby 1.8.7 (2010-04-19 patchlevel 253) [x86_64-linux], MBARI 0x6770, Ruby Enterprise Edition 2010.02 # rails -v Rails 2.3.5 # gem -v 1.3.7
vi /etc/httpd/conf/httpd.conf
290 Options FollowSymLinks Indexes ExecCGI MultiViews 320 AllowOverride All 560 #ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" ScriptAlias /cgi-bin/ "/var/www/"
vi /etc/httpd/conf.d/virtual_domain.conf
NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot /var/www/html ServerName vps.exsample.com </VirtualHost> <VirtualHost *:80> DocumentRoot /var/www/redmine/public ServerName redmine.exsample.com </VirtualHost>
vi /var/www/html/index.html
text
vi /var/www/html/perl.cgi
#!/usr/bin/perl use strict; use warnings; use CGI; use CGI::Carp qw(fatalsToBrowser); my $q = new CGI; print $q->header(); print "perl";
yes '' | perl -MCPAN -e 'install MODULE_NAME'
yes '' | perl -MCPAN -e 'install YAML' yes '' | perl -MCPAN -e 'install DBIx::Class' yes '' | perl -MCPAN -e 'install Templete' yes '' | perl -MCPAN -e 'install Net::Twitter::Lite' yes '' | perl -MCPAN -e 'install WWW::Mechanize' yes '' | perl -MCPAN -e 'install Net-SSLeay' yes '' | perl -MCPAN -e 'install Web::Scraper'
Subversion インストール
vi /etc/httpd/conf.d/subversion.conf >Location /repos< DAV svn SVNParentPath /var/www/svn SVNAutoversioning on # Limit write permission to list of valid users. >LimitExcept GET PROPFIND OPTIONS REPORT< # Require SSL connection for password protection. # SSLRequireSSL AuthType Basic AuthName "Authorization Realm" AuthUserFile /etc/httpd/conf/.htpasswd Require valid-user >/LimitExcept< >/Location<
vi /etc/httpd/conf/httpd.conf LoadModule dav_svn_module modules/mod_dav_svn.so service httpd restart
vi /etc/httpd/subversion.conf <Location "/svn"> SSLRequireSSL DAV svn SVNParentPath "/var/www/svn" SVNAutoversioning On </Location> <Location "/svn/test"> AuthType Basic AuthName "Subversion for test" AuthBasicProvider file AuthUserFile /etc/httpd/conf/.htpasswd Require valid-user </Location>
クライアント(Windows)で TortoiseSVNをインストール
適当なフォルダで右クリックして、「Checkout」を選択
URLに以下のようなテキストを入力
svn+ssh://UserID.exsample.com/var/www/svn/repos
出力例:
Using username "root". root@59.106.175.204's password: SAKURA Internet [Virtual Private Server SERVICE] [root@www2410u ~]# ls [root@www2410u ~]# yum install httpd Loaded plugins: fastestmirror Determining fastest mirrors * addons: ftp.iij.ad.jp * base: ftp.iij.ad.jp * extras: ftp.iij.ad.jp * updates: ftp.daum.net addons | 951 B 00:00 addons/primary | 204 B 00:00 base | 2.1 kB 00:00 base/primary_db | 2.1 MB 00:00 extras | 2.1 kB 00:00 extras/primary_db | 226 kB 00:00 updates | 1.9 kB 00:00 updates/primary_db | 603 kB 00:06 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package httpd.x86_64 0:2.2.3-43.el5.centos.3 set to be updated addons/filelists | 197 B 00:00 base/filelists_db | 4.0 MB 00:00 extras/filelists_db | 220 kB 00:00 updates/filelists_db | 1.9 MB 00:18 --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: httpd x86_64 2.2.3-43.el5.centos.3 updates 1.2 M Transaction Summary ================================================================================ Install 1 Package(s) Upgrade 0 Package(s) Total download size: 1.2 M Is this ok [y/N]: y Downloading Packages: httpd-2.2.3-43.el5.centos.3.x86_64.rpm | 1.2 MB 00:13 warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897 updates/gpgkey | 1.5 kB 00:00 Importing GPG key 0xE8562897 "CentOS-5 Key (CentOS 5 Official Signing Key)" from /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 Is this ok [y/N]: y Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : httpd 1/1 Installed: httpd.x86_64 0:2.2.3-43.el5.centos.3 Complete! [root@www2410u ~]# service httpd start Starting httpd: [ OK ] [root@www2410u ~]# 0 Package(s) y
[root@www2410u ~]# yum -y install mysql-server Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * addons: ftp.iij.ad.jp * base: ftp.iij.ad.jp * extras: ftp.iij.ad.jp * updates: ftp.daum.net addons | 951 B 00:00 base | 2.1 kB 00:00 extras | 2.1 kB 00:00 updates | 1.9 kB 00:00 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package mysql-server.x86_64 0:5.0.77-4.el5_5.3 set to be updated --> Processing Dependency: mysql = 5.0.77-4.el5_5.3 for package: mysql-server --> Processing Dependency: perl-DBD-MySQL for package: mysql-server --> Processing Dependency: libmysqlclient.so.15(libmysqlclient_15)(64bit) for package: mysql-server --> Processing Dependency: libmysqlclient_r.so.15(libmysqlclient_15)(64bit) for package: mysql-server --> Processing Dependency: perl(DBI) for package: mysql-server --> Processing Dependency: perl-DBI for package: mysql-server --> Processing Dependency: libmysqlclient_r.so.15()(64bit) for package: mysql-server --> Processing Dependency: libmysqlclient.so.15()(64bit) for package: mysql-server --> Running transaction check ---> Package mysql.x86_64 0:5.0.77-4.el5_5.3 set to be updated ---> Package perl-DBD-MySQL.x86_64 0:3.0007-2.el5 set to be updated ---> Package perl-DBI.x86_64 0:1.52-2.el5 set to be updated --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: mysql-server x86_64 5.0.77-4.el5_5.3 updates 9.8 M Installing for dependencies: mysql x86_64 5.0.77-4.el5_5.3 updates 4.8 M perl-DBD-MySQL x86_64 3.0007-2.el5 base 148 k perl-DBI x86_64 1.52-2.el5 base 600 k Transaction Summary ================================================================================ Install 4 Package(s) Upgrade 0 Package(s) Total download size: 15 M Downloading Packages: (1/4): perl-DBD-MySQL-3.0007-2.el5.x86_64.rpm | 148 kB 00:00 (2/4): perl-DBI-1.52-2.el5.x86_64.rpm | 600 kB 00:00 (3/4): mysql-5.0.77-4.el5_5.3.x86_64.rpm | 4.8 MB 00:49 (4/4): mysql-server-5.0.77-4.el5_5.3.x86_64.rpm | 9.8 MB 01:48 -------------------------------------------------------------------------------- Total 99 kB/s | 15 MB 02:38 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : perl-DBI 1/4 Installing : mysql 2/4 Installing : perl-DBD-MySQL 3/4 Installing : mysql-server 4/4 Installed: mysql-server.x86_64 0:5.0.77-4.el5_5.3 Dependency Installed: mysql.x86_64 0:5.0.77-4.el5_5.3 perl-DBD-MySQL.x86_64 0:3.0007-2.el5 perl-DBI.x86_64 0:1.52-2.el5 Complete!
phpMyAdmin-3.3.6-all-languages.tar.gz wget http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.3.6/phpMyAdmin-3.3.6-all-languages.tar.gz?r=http%3A%2F%2Fwww.phpmyadmin.net%2Fhome_page%2Findex.php
[root@www2410u html]# rpm -qa php* [root@www2410u html]# yum install php php-mysql Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * addons: ftp.iij.ad.jp * base: ftp.iij.ad.jp * extras: ftp.iij.ad.jp * updates: ftp.daum.net Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package php.x86_64 0:5.1.6-27.el5 set to be updated --> Processing Dependency: php-common = 5.1.6-27.el5 for package: php --> Processing Dependency: php-cli = 5.1.6-27.el5 for package: php ---> Package php-mysql.x86_64 0:5.1.6-27.el5 set to be updated --> Processing Dependency: php-pdo for package: php-mysql --> Running transaction check ---> Package php-cli.x86_64 0:5.1.6-27.el5 set to be updated ---> Package php-common.x86_64 0:5.1.6-27.el5 set to be updated ---> Package php-pdo.x86_64 0:5.1.6-27.el5 set to be updated --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: php x86_64 5.1.6-27.el5 base 2.3 M php-mysql x86_64 5.1.6-27.el5 base 89 k Installing for dependencies: php-cli x86_64 5.1.6-27.el5 base 2.2 M php-common x86_64 5.1.6-27.el5 base 153 k php-pdo x86_64 5.1.6-27.el5 base 66 k Transaction Summary ================================================================================ Install 5 Package(s) Upgrade 0 Package(s) Total download size: 4.8 M Is this ok [y/N]: y Downloading Packages: (1/5): php-pdo-5.1.6-27.el5.x86_64.rpm | 66 kB 00:00 (2/5): php-mysql-5.1.6-27.el5.x86_64.rpm | 89 kB 00:00 (3/5): php-common-5.1.6-27.el5.x86_64.rpm | 153 kB 00:00 (4/5): php-cli-5.1.6-27.el5.x86_64.rpm | 2.2 MB 00:00 (5/5): php-5.1.6-27.el5.x86_64.rpm | 2.3 MB 00:00 -------------------------------------------------------------------------------- Total 10 MB/s | 4.8 MB 00:00 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : php-common 1/5 Installing : php-cli 2/5 Installing : php-pdo 3/5 Installing : php 4/5 Installing : php-mysql 5/5 Installed: php.x86_64 0:5.1.6-27.el5 php-mysql.x86_64 0:5.1.6-27.el5 Dependency Installed: php-cli.x86_64 0:5.1.6-27.el5 php-common.x86_64 0:5.1.6-27.el5 php-pdo.x86_64 0:5.1.6-27.el5 Complete!
[root@www2410u html]# yum install vsftpd Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * addons: ftp.iij.ad.jp * base: ftp.iij.ad.jp * extras: ftp.iij.ad.jp * updates: ftp.daum.net Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package vsftpd.x86_64 0:2.0.5-16.el5_5.1 set to be updated utterramblings/filelists | 35 kB 00:00 --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: vsftpd x86_64 2.0.5-16.el5_5.1 updates 139 k Transaction Summary ================================================================================ Install 1 Package(s) Upgrade 0 Package(s) Total download size: 139 k Is this ok [y/N]: y Downloading Packages: vsftpd-2.0.5-16.el5_5.1.x86_64.rpm | 139 kB 00:01 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : vsftpd 1/1 Installed: vsftpd.x86_64 0:2.0.5-16.el5_5.1 Complete!