This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# template script for generating CentOS container for LXC | |
# | |
# | |
# lxc: linux Container library | |
# Authors: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#For CentOS | |
echo "Hello OpenStack World. This is User-Data Test" | tee /root/hello.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oct 21 00:29:11 stack01 iscsid: iSCSI logger with pid=29419 started! | |
Oct 21 00:29:11 stack01 kernel: [ 1381.688611] Loading iSCSI transport class v2.0-870. | |
Oct 21 00:29:12 stack01 iscsid: iSCSI daemon with pid=29420 started! | |
Oct 21 00:29:13 stack01 kernel: [ 1382.999501] iscsi: registered transport (tcp) | |
Oct 21 00:29:13 stack01 kernel: [ 1383.256022] scsi2 : iSCSI Initiator over TCP/IP | |
Oct 21 00:29:13 stack01 kernel: [ 1383.762305] scsi 2:0:0:0: RAID IET Controller 0001 PQ: 0 ANSI: 5 | |
Oct 21 00:29:13 stack01 kernel: [ 1383.763668] scsi 2:0:0:0: Attached scsi generic sg0 type 12 | |
Oct 21 00:29:13 stack01 kernel: [ 1383.764556] scsi 2:0:0:1: Direct-Access IET VIRTUAL-DISK 0001 PQ: 0 ANSI: 5 | |
Oct 21 00:29:13 stack01 kernel: [ 1383.764771] sd 2:0:0:1: [sda] 2097152 512-byte logical blocks: (1.07 GB/1.00 GiB) | |
Oct 21 00:29:13 stack01 kernel: [ 1383.764905] sd 2:0:0:1: [sda] Write Protect is off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rpm -ivh http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm | |
rpm -ivh http://rpms.famillecollet.com/enterprise/6/remi/x86_64/remi-release-6.4-1.el6.remi.noarch.rpm | |
yum install redis git -y | |
chkconfig redis on | |
service redis start | |
curl https://raw.github.com/creationix/nvm/master/install.sh | sh | |
source ~/.nvm/nvm.sh | |
#node.jsの最新版をインストール | |
nvm install $(nvm ls-remote | tail -1 | awk '{print $1}') | |
#expressをインストール |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ディレクトリ作成、移動 | |
mkdir centos_ssh | |
cd centos_ssh | |
#コンテナイメージ作成ファイルの作成 | |
vi Dockerfile | |
#choice container image | |
FROM centos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Ubuntu13.10 | |
sudo sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -" | |
sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\ | |
> /etc/apt/sources.list.d/docker.list" | |
sudo apt-get update | |
sudo apt-get install lxc-docker -y | |
sudo docker run -i -t centos /bin/bash | |
#Ubuntu13.04 | |
sudo apt-get install software-properties-common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#choice container image | |
FROM centos | |
#add repository | |
RUN rpm -ivh http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm | |
#install package | |
RUN yum install -y passwd | |
RUN yum install -y openssh-server | |
RUN yum install -y openssh-clients |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Ansibleのインストール | |
rpm -ivh http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm | |
yum install git -y | |
yum groupinstall "Development tools" -y | |
yum install PyYAML python-jinja2 python2-devel -y | |
yum install python-setuptools python-keyczar python-paramiko sshpass asciidoc -y | |
cd /usr/local/src | |
git clone git://github.com/ansible/ansible.git | |
cd ./ansible | |
make rpm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SELinux setting | |
sed -i.bak "s/\(^SELINUX=\).*/\1disabled/" /etc/selinux/config | |
#IPv4Forwarding setting | |
sed -i.bak "s/net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/" /etc/sysctl.conf | |
######################################################################################## | |
# add Repository | |
rpm -ivh http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ビルド | |
docker build -t "sshd/centos" . | |
#コンテナを起動 | |
docker run -i -t centos /bin/bash | |
#コンテナに名前を付けて起動 | |
docker run -i -t --name cent01 centos /bin/bash | |
#コンテナをバックグランドで起動 |
OlderNewer