アーキテクチャ,OS,リソース確認
# uname -a #システム情報
# cat /etc/redhat-release #redhat系の場合、OSイメージ
# free -h #memory
# df -h #HDD
useradd
# useradd hogehoge -g wheel -m #個人ユーザ作成
/etc/hosts.allow /etc/hosts.deny
ここはまだ設定してない
/etc/hosts.allow
ALL : 127.0.0.1
sshd : ALL
/etc/hosts.deny
ALL : ALL
network
# hostnamectl set-hostname tool_srv01 #host名
# nmcli d #device名確認
# nmcli c modify enp3s0f0 connection.autoconnect yes #起動時にnicをupする
# nmcli c modify enp3s0f0 ipv4.addresses 192.168.100.200/24 #nicのip設定
# nmcli c modify enp3s0f0 ipv4.gateway 192.168.100.1 #defaultgw
# nmcli c modify enp3s0f0 ipv4.dns 192.168.100.1 #nicのdns設定
# nmcli c modify enp3s0f0 ipv4.method manual #固定IP (DHCP auto)
# nmcli c down enp3s0f0; nmcli c up enp3s0f0 #nic毎の再起動
# nmcli d show enp3s0f0 #nic設定確認
# ip a #ipの設定確認
# cat /etc/sysconfig/network-scripts/ifcfg-enp3s0f0 #こっちのファイルに反映されてる
firewall
firewalled無効化
# systemctl stop firewalld.service
# systemctl mask firewalld.service #
# systemctl status firewalld
firewalld.service masked
iptables
# yum -y update #packageを最新化
# yum -y install iptables #install
# systemctl start iptables-services #centos7ではiptablesではなく、iptables-servicesをインストールする
# systemctl enable iptables
# systemctl list-unit-files | grep iptables
iptables.service enabled
とりあえず起動だけ、設定は以下ファイルに実施後、restart
/etc/sysconfig/iptalbes
ssh
/etc/ssh/sshd_config
PermitRootLogin no
sshd再起動
# systemctl restart sshd
SELINUX
設定後rebootが必要
/etc/selinux/config
SELINUX=disabled # disabled に変更
install docker
# yum install -y epel-release #epelリポジトリ インストール
# yum install -y docker-io #docker install
# docker -v #version
Docker version 1.12.6, build 88a4867/1.12.6
# systemctl start docker #docker起動
# systemctl status docker
# systemctl enable docker #起動時にdockerを起動
install portainer
# yum install -y git
# git --version
git version 1.8.3.1
# cd opt
# git clone https://github.com/portainer/portainer
# docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer
# docker ps -a #起動を確認
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9612d3054944 portainer/portainer "/portainer" 59 minutes ago Up 4 minutes 0.0.0.0:9000->9000/tcp hopeful_murdock
# docker update --restart=always 9612d3054944 #再起動時にこのコンテナを立ち上げる,restartはrunのオプションで最初から指定も可
- http://[IPアドレス]:9000
- adminパスワード設定画面
- Connect Portainer to a Docker engine or Swarm cluster endpoint
- Manage the Docker instance where Portainer is running →ローカルのdockerインスタンスを管理する場合はこちらを選択
- Manage a remote Docker instance