アットウィキロゴ

Linuxサーバ構築

Ubuntu Server 12.04を用いたHTTPサーバ、DBサーバ、メールサーバなどの構築のための記録

導入

ISO取得
http://www.ubuntu.com/download/server
からUbuntu Server 12.04.3 LTSを取得。
メディアに焼くなどしてブートします。あとは指示にしたがって素直にインストール。

注意
インストール途中でhome directoryを暗号化するかどうか、という質問がでるがこれにYesと答えると
SSHはクライアントの公開鍵の置き場所を変えるなどしないといけなくなります。

SSHサーバ導入

KVMのコンソールが非常に使いにくいので最初のこれをインストール
sudo apt-get install ssh

バックアップ環境構築

とりあえず、動かそうとすると後に回しそうだがこれは非常に重要。
規模が大きくなってから失ったら取り返しがつかないです。

ディスク全体フルバックアップ http://www.kkaneko.com/rinkou/linux/remastersys.html
remastersysというプログラムを使って全体のバックアップを行います。
情報の劣化が起こるといけないので上記urlを参照してremastersysをインストールしてください。

次にcronの設定を行い毎日自動で行うが、sudoで実行するためこのままでは実行できない。
sudo visudo
でsudoerの編集を行います。
# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) NOPASSWD:ALL
 
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
 
# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL
username  ALL=(ALL)  NOPASSWD:/usr/bin/remastersys    ←追加
 
 
# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d
これで自動バックアップが行えます。

GCCのインストール

sudo apt-get install gcc

Apache2のインストール

ソースコードの取得
wget http://ftp.kddilabs.jp/infosystems/apache//httpd/httpd-2.4.6.tar.gz
gunzip httpd-2.4.6.tar.gz
tar -xvf httpd-2.4.6.tar 
解凍されたディレクトリにはいり
./configure 
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure: 
configure: Configuring Apache Portable Runtime library...
configure: 
checking for APR... no
configure: error: APR not found.  Please read the documentation.
APRがない。libapr1-dev,libaprutil1-devをインストール
sudo apt-get install libapr1-dev
sudo apt-get install libaprutil1-dev
./configure
できた。makeがないことにここで気づいたのでmakeをインストール
sudo apt-get install make
//httpdの場所へ移動
make
sudo make install //ディレクトリを作るタイミングで権限が必要なため
 
インストールはこれで完了。
最終更新:2013年10月15日 20:52