本物のサーバを立てる前によくvmwareである程度構築手順を試してやるので、その時のメモ。といってもvmware playerでやっているので、他のツールはいろいろと自分で揃えておくこと。vmwareじゃなくても構築手順はそれなりに使えたりする。
これをもとにその後の用途に応じたサーバを構築すればいいかなと
これをもとにその後の用途に応じたサーバを構築すればいいかなと
http://www.h7.dion.ne.jp/~qemu-win/index-ja.html
開発は停止している。大容量の仮想できない(実際はsparseファイル)も作成できるがIDEしか無理
開発は停止している。大容量の仮想できない(実際はsparseファイル)も作成できるがIDEしか無理
# 10Gの仮想ディスクファイルを作成する例 qemu-img create -f vmdk image.vmdk 10G
http://www.geocities.co.jp/SiliconValley/2994/tool...
SCSIも対応しているが、大容量の仮想ディスクが作成できない。とりあえず画面にそって作るだけなのでこっちを使う
SCSIも対応しているが、大容量の仮想ディスクが作成できない。とりあえず画面にそって作るだけなのでこっちを使う
device | mount point | file system | space |
---|---|---|---|
sda1 | /boot | ext3 | 100MB |
sda2 | / | ext3 | のこり |
sda3 | /var | ext3 | 8192MB |
sda4 | - | extended | - |
sda5 | - | swap | 1024MB |
基本的にすべてrootの作業。patchの当て方は以下を参考にする
# patchあて対象ファイルがあるディレクトリに移動 cd /path/to # patchをあてる patch < /patch_file/path/to/foo.patch
基本的にインストール時の言語設定に依存する。設定ファイルは/etc/sysconfig/i18nに記述されている
# 英語でインストール作業をしていたのでこのようになっている LANG="en_US.UTF-8" SYSFONT="latarcyrheb-sun16"変更したい場合はLANGを他の言語に設定する(日本語ならja_JP.UTF-8など。とりあえずCにする)
sed -i.org -e 's/^\(LANG\)=.*$/\1=C/' /etc/sysconfig/i18n
--- fstab.org 2009-12-19 00:55:23.000000000 +0900 +++ fstab 2009-12-19 01:16:36.000000000 +0900 @@ -1,7 +1,7 @@ -LABEL=/ / ext3 defaults 1 1 -LABEL=/var /var ext3 defaults 1 2 -LABEL=/boot /boot ext3 defaults 1 2 +/dev/sda2 / ext3 defaults 1 1 +/dev/sda3 /var ext3 defaults 1 2 +/dev/sda1 /boot ext3 defaults 1 2 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 -LABEL=SWAP-sda5 swap swap defaults 0 0 +/dev/sda5 swap swap defaults 0
--- grub.conf 2009-12-19 01:02:35.000000000 +0900 +++ grub.conf 2009-12-19 01:16:53.000000000 +0900 @@ -13,5 +13,5 @@ hiddenmenu title CentOS (2.6.18-164.el5) root (hd0,0) - kernel /vmlinuz-2.6.18-164.el5 ro root=LABEL=/ + kernel /vmlinuz-2.6.18-164.el5 ro root=/dev/sda2 initrd /initrd-2.6.18-164.el5.img
パスワード認証は不可、root以外はとりあえずログインできないように/etc/ssh/sshd_configを変更する
--- sshd_config.org 2009-09-04 03:12:38.000000000 +0900 +++ sshd_config 2009-12-21 00:01:02.000000000 +0900 @@ -57,7 +57,7 @@ # To disable tunneled clear text passwords, change to no here! #PasswordAuthentication yes #PermitEmptyPasswords no -PasswordAuthentication yes +PasswordAuthentication no # Change to no to disable s/key passwords #ChallengeResponseAuthentication yes @@ -71,9 +71,9 @@ # GSSAPI options #GSSAPIAuthentication no -GSSAPIAuthentication yes +GSSAPIAuthentication no #GSSAPICleanupCredentials yes -GSSAPICleanupCredentials yes +GSSAPICleanupCredentials no # Set this to 'yes' to enable PAM authentication, account processing, # and session processing. If this is enabled, PAM authentication will @@ -84,7 +84,7 @@ # session checks to run without PAM authentication, then enable this but set # ChallengeResponseAuthentication=no #UsePAM no -UsePAM yes +UsePAM no # Accept locale-related environment variables AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES @@ -106,7 +106,7 @@ #ClientAliveInterval 0 #ClientAliveCountMax 3 #ShowPatchLevel no -#UseDNS yes +UseDNS no #PidFile /var/run/sshd.pid #MaxStartups 10 #PermitTunnel no @@ -117,3 +117,6 @@ # override default of no subsystems Subsystem sftp /usr/libexec/openssh/sftp-server + +# only root +AllowUsers root
mkdir ~/.ssh echo "ssh-dss AAAAB3NzaC1kc3MAAACBAMWmPi/Qkh1PsoosvPPngmWdiDyVT5TQJmkPxvUzQnjJaEKYeC3xjUr0xystPYbQ7CnUkOvajuFQ+pSZPqAbYM23QyXfVYQ84ba2hKWxjEQe8Fg08COLIGcQEIklLZss54hsQlcBYfVN1BjBRmhPCQAc+LL2NisStlbh0kfh+Xi1AAAAFQDspHXE2/8hI3iPxPwaUFx2sdr0TQAAAIBeJO/yKgo90bz1it0XwordAyT4Ah+zVMZD8vPPN0dHxpzdbBkqDXQp77f4REXMOvtdLVaSZCX6Jujjp+DEsp5wYWE6L2IYXvgyy6lklylifqtIQqorraoYTuOh+2oe5y0irSdlYI/VGIPSGB5Z0zTXNc+7MtWv7286t8l2W21pTgAAAIAMX/bJ/Cv8q2uQhZQNo/vjVIT78LBUI9aPh1qS21nQv377wF6a469CNaJRSRrxD4kT0lnwUpQMPEvOdEpodVi5VP0c+IjHZEOVaXoXVbJH0k30E226j6j99865hTUF34RvYf4AE62TQysHgp4t0/D7EMW+FF3nTuLeFXeHdKBr1g== admin@fedora8" > ~/.ssh/authorized_keys chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys
バージョンはその都度確認すること
wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm rpm -ivh rpmforge-release-0.3.6-1.el5.rf.i386.rpm sed -i.org -e 's/^\(enabled\) = 1/\1 = 0/' /etc/yum.repos.d/rpmforge.repo
wget http://download.fedora.redhat.com/pub/epel/5/$(uname -i)/epel-release-5-3.noarch.rpm rpm -ivh epel-release-5-3.noarch.rpm sed -i.org -e "s/^\(enabled\)=1/\1=0/" /etc/yum.repos.d/epel.repo
cat <<EOL > /etc/yum.repos.d/atrpms.repo [atrpms] name=Redhat Enterprise Linux \$releasever - \$basearch - ATrpms baseurl=http://dl.atrpms.net/el\$releasever-\$basearch/atrpms/stable enabled=0 gpgcheck=1 gpgkey=http://atrpms.net/RPM-GPG-KEY.atrpms EOL # GPGkeyを取り込む rpm --import http://atrpms.net/RPM-GPG-KEY.atrpms
wget http://rpm.livna.org/livna-release.rpm rpm -ivh livna-release.rpm sed -i.org -e "s/^\(enabled\)=1/\1=0/" /etc/yum.repos.d/epel.repo
yum -y remove bluez-gnome bluez-libs bluez-utils cvs talk yp-tools ypbind yum-updatesd subversion lftp postgresql-libs apr-util
何かと便利なのでインストールしておく
yum -y install screen設定は~/.screenrcを設置する
autodetach on bell_msg "^G" defkanji utf-8 defencoding utf-8 encoding utf-8 utf-8 defscrollback 10000 startup_message off vbell off #caption always "%{= wb} %-w%{=bu dr}%n %t%{-}%+w %= %{=b wk} [%l] %{=b wb}%y/%m/%d(%D) %{=b wm}%c" caption always "%{= wb} %-w%{=bu dr}%n %t%{-}%+w %= %{=b wk} [%l] %{=b wb}%Y/%m/%d %{=b wm}%c:%s" # デフォルトの設定をはずしたい場合は以下のコメントをはずす escape ^Jj
alternatives --config mta There are 2 programs which provide 'mta'. Selection Command ----------------------------------------------- *+ 1 /usr/sbin/sendmail.sendmail 2 /usr/sbin/sendmail.postfix Enter to keep the current selection[+], or type selection number: <- 2を入力
/etc/postfix/main.cfを変更する
--- main.cf 2008-08-15 06:06:30.000000000 +0900 +++ main.cf 2009-12-19 02:20:33.000000000 +0900 @@ -68,6 +68,7 @@ # #myhostname = host.domain.tld #myhostname = virtual.domain.tld +myhostname = localhost.localdomain # The mydomain parameter specifies the local internet domain name. # The default is to use $myhostname minus the first component. @@ -75,6 +76,7 @@ # parameters. # #mydomain = domain.tld +mydomain = localdomain # SENDING MAIL # @@ -91,6 +93,7 @@ # #myorigin = $myhostname #myorigin = $mydomain +myorigin = $myhostname # RECEIVING MAIL @@ -152,10 +155,11 @@ # # See also below, section "REJECTING MAIL FOR UNKNOWN LOCAL USERS". # -mydestination = $myhostname, localhost.$mydomain, localhost +#mydestination = $myhostname, localhost.$mydomain, localhost #mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain #mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, # mail.$mydomain, www.$mydomain, ftp.$mydomain +mydestination = $myhostname, localhost # REJECTING MAIL FOR UNKNOWN LOCAL USERS # @@ -408,6 +412,7 @@ # #home_mailbox = Mailbox #home_mailbox = Maildir/ +home_mailbox = Maildir/ # The mail_spool_directory parameter specifies the directory where # UNIX-style mailboxes are kept. The default setting depends on the
chkconfig yum-cron on chkconfig rsyslog on chkconfig postfix on # 停止と起動 /etc/rc.d/init.d/syslog stop && /etc/rc.d/init.d/rsyslog start /etc/rc.d/init.d/sendmail stop && /etc/rc.d/init.d/postfix start
使うのならやる必要はないけど
# IPV6関係が存在する場合は実行 sed -i -e "s/^\(IPV6INIT\)/#\1/" -e "s/^\(IPV6_AUTOCONF\)/#\1/" /etc/sysconfig/network-scripts/ifcfg-eth0 sed -i -e "s/^\(NETWORKING_IPV6\)/#\1/" /etc/sysconfig/network # これを記述していれば確実 cat <<EOL >> /etc/sysconfig/network NETWORKING_IPV6=no IPV6INIT=no IPV6_AUTOCONF=no EOL /etc/rc.d/init.d/network restart # IPv6関係のkernelモジュールも読み込まれないようにしておく。5.4以前はoptions ipv6 disable=1の代わりにinstall ipv6 /bin/true cp -p /etc/modprobe.conf /etc/modprobe.conf.org cat <<EOL >> /etc/modprobe.conf alias net-pf-10 off options ipv6 disable=1 EOL次回起動後、netstat -anで
::ffff:192.168.1.203:22このような表示がされていなければよい
実行後、再起動する
yum clean all yum -y --enablerepo=rpmforge --enablerepo=epel --enablerepo=atrpms --enablerepo=livna update shutdown -r now
このあたりでそろそろインストールする。VMware Serverの付属品として入っているのでhttp://www.vmware.com/jp/products/server/ から最新版をダウンロードする
vmware playerのVMware Player>共有フォルダを選択して常に有効を選択しておく。これで起動後、自動的に/mnt/hgfsとsharedFolder0.hostPathで設定されているフォルダがmountされる
# versionはその都度確認 tar xvfz VMware-server-2.0.2-203138.i386.tar.gz mount -t iso9660 -r -o loop /root/vmware-server-distrib/lib/isoimages/linux.iso /mnt rpm -ivh /mnt/VMwareTools-7.7.6-203138.i386.rpm Preparing... ########################################### [100%] 1:VMwareTools ########################################### [100%] The installation of VMware Tools 7.7.6 for Linux completed successfully. You can decide to remove this software from your system at any time by invoking the following command: "rpm -e VMwareTools". Before running VMware Tools for the first time, you need to configure it for your running kernel by invoking the following command: "/usr/bin/vmware-config-tools.pl". Enjoy, --the VMware team umount /mnt
vmware-config-tools.plを実行するといろいろ質問されるので、基本すべてyesにする
It looks like you are trying to run this program in a remote session. This program will temporarily shut down your network connection, so you should only run it from a local console session. Are you SURE you want to continue? [no] <- yes Stopping VMware Tools services in the virtual machine: Guest operating system daemon: [ OK ] The bld-2.6.18-8.el5-i686smp-RHEL5 - vmmemctl module loads perfectly into the running kernel. The bld-2.6.18-8.el5-i686smp-RHEL5 - vmhgfs module loads perfectly into the running kernel. The bld-2.6.18-8.el5-i686smp-RHEL5 - vmxnet module loads perfectly into the running kernel. The bld-2.6.18-8.el5-i686smp-RHEL5 - vmblock module loads perfectly into the running kernel. [EXPERIMENTAL] The VMware FileSystem Sync Driver (vmsync) is a new feature that creates backups of virtual machines. Please refer to the VMware Knowledge Base for more details on this capability. Do you wish to enable this feature? [no] <- yes。いれておくと時刻同期とかホストOSとmountできたりする The bld-2.6.18-8.el5-i686smp-RHEL5 - vmsync module loads perfectly into the running kernel. The bld-2.6.18-8.el5-i686smp-RHEL5 - vmci module loads perfectly into the running kernel. The bld-2.6.18-8.el5-i686smp-RHEL5 - vsock module loads perfectly into the running kernel. No X install found. Starting VMware Tools services in the virtual machine: Switching to guest configuration: [ OK ] Guest filesystem driver: [ OK ] Mounting HGFS shares: [ OK ] Guest memory manager: [ OK ] VM communication interface: [ OK ] VM communication interface socket family: [ OK ] Blocking file system: [ OK ] File system sync driver: [ OK ] Guest operating system daemon: [ OK ] The configuration of VMware Tools 7.7.6 build-203138 for Linux for this running kernel completed successfully. You must restart your X session before any mouse or graphics changes take effect. You can now run VMware Tools by invoking the following command: "/usr/bin/vmware-toolbox" during an X server session. You will need to either manually start /usr/bin/vmware-user or log out and log back in to this desktop session to obtain the following features: guest resolution fit, drag and drop, and file and text copy/paste. vmware-user is configured to automatically start at a graphical login, but that won't take effect until the next login. Enjoy, --the VMware team終了後、/etc/fstabに
# Beginning of the block added by the VMware software .host:/ /mnt/hgfs vmhgfs defaults,ttl=5 0 0 # End of the block added by the VMware softwareが追記され、dfを行うと
Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda2 19187244 3094420 15102420 18% / /dev/sda1 101086 17703 78164 19% /boot tmpfs 257664 0 257664 0% /dev/shm .host:/ 202186024 56695244 145490780 29% /mnt/hgfsとmountされていることが確認できる。yum updateでkernelがバージョンアップした場合は必ずvmware-config-tools.plを実行すること
anacron 0:off 1:off 2:on 3:on 4:on 5:on 6:off auditd 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 iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off irqbalance 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 postfix 0:off 1:off 2:on 3:on 4:on 5:on 6:off rawdevices 0:off 1:off 2:off 3:on 4:on 5:on 6:off rsyslog 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 vmware-tools 0:off 1:off 2:on 3:on 4:off 5:on 6:off yum-cron 0:off 1:off 2:on 3:on 4:on 5:on 6:off
選択したVMのsummary > console にGenerate Virtual Machine Shortcutという項目があるので、これでデスクトップにお目当てのVMのショートカットを作成
タグ
最新コメント