CentOS 7 に Kernel 4.6系をインストールする方法

現時点のカーネルバージョンを確認します。

# uname -r
3.10.0-327.18.2.el7.x86_64


カーネルのインストールに使う、レポジトリを追加します。

# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm


最新カーネルをインストールします。

# yum -y install --enablerepo=elrepo-kernel kernel-ml


/boot直下にKernel 4.6 系に関連するファイルが複数生成されています。

# ls -1 /boot/ | grep -E '.*-4\.'
System.map-4.6.2-1.el7.elrepo.x86_64
config-4.6.2-1.el7.elrepo.x86_64
initramfs-4.6.2-1.el7.elrepo.x86_64.img
symvers-4.6.2-1.el7.elrepo.x86_64.gz
vmlinuz-4.6.2-1.el7.elrepo.x86_64


最新カーネルがサーバ起動時に読み込まれるように/etc/default/grubを編集します。

# sed -i "s/^GRUB_DEFAULT\=.*/GRUB_DEFAULT\=0/g" /etc/default/grub


GRUBをアップデートします。

# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.6.2-1.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-4.6.2-1.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-327.18.2.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.18.2.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-f09801905e2f4e13966d8d90c3939e2e
Found initrd image: /boot/initramfs-0-rescue-f09801905e2f4e13966d8d90c3939e2e.img


サーバを最新カーネルで起動させるため、再起動します。

# reboot


再起動後、カーネルが4系になったことを確認できました。

# uname -r
4.6.2-1.el7.elrepo.x86_64

Ansible(2系) インストール方法まとめ

f:id:sabakan1204:20160603164812p:plain

CentOS 7


Yum でインストールする場合

YumリポジトリにEPELを追加します。

# yum install -y epel-release

Ansibleをインストールします。

# yum install -y --enablerepo=epel ansible

バージョンを確認します。

# ansible --version
ansible 2.0.2.0

pip(ピップ)でインストールする場合

YumリポジトリにEPELを追加します。

# yum install -y epel-release libffi-devel

pipのインストールと更新をします。

# yum install -y --enablerepo=epel python-pip
# pip install --upgrade pip

Ansibleのコンパイルに必要なパッケージをインストールします。

# yum install -y gcc libffi-devel openssl openssl-devel python-devel libcurl-devel

Ansibleをインストールします。

# pip install ansible

Ansibleを更新します。

# pip install --upgrade ansible

バージョンを確認します。

# ansible --version
ansible 2.1.0.0

バージョン確認時に下記のエラーメッセージが表示される場合は、pip install --upgrade ansible を実行してください。

# ansible --version
ERROR! Unexpected Exception: (setuptools 0.9.8 (/usr/lib/python2.7/site-packages), Requirement.parse('setuptools>=11.3'))

Ubuntu 14.04 /16.04


apt でインストールする場合

レポジトリを追加します。

$ sudo apt install -y software-properties-common
$ sudo apt-add-repository ppa:ansible/ansible

Ansibleをインストールします。

$ sudo apt update
$ sudo apt install -y ansible

バージョンを確認します

$ ansible --version
ansible 2.1.0.0

pipでインストールする場合

python-setuptoolsをインストールします。

$ sudo apt install -y python-setuptools

pipのインストールと更新をします。

$ sudo apt install -y python-pip
$ sudo pip install pip --upgrade

Ansibleのコンパイルに必要なパッケージをインストールします。

$ sudo apt install -y python-dev libffi-dev libssl-dev

Ansibleをインストールします。

$ sudo pip install ansible

Ansibleを更新します。

$ sudo pip install --upgrade ansible

バージョンを確認します。

# ansible --version
ansible 2.1.0.0