LoginSignup
171
192

More than 5 years have passed since last update.

私がCentOS 7を入れたら最初にやること

Last updated at Posted at 2014-11-01

ひどく個人的なノウハウですが、私がCentOS 7 を入れたら最初にやることです。

DVDのisoからブート。最小構成で入れて、NICの設定はインストラーでGUIで設定する。

SELinuxを切る

変更

setenforce 0
getenforce
#-> Permissiveを確認

永続化
/etc/selinux/configに対して

SELINUX=disabled

FWを切る

#変更
systemctl stop firewalld
#永続化
systemctl disable firewalld

IPアドレス付与

CentOS7から設定ファイルは直接弄ってはいけないという思想になったため、コマンドラインツールで設定する。

#設定
nmcli connection modify eth0 ipv4.method manual ipv4.addresses 192.168.1.20/24 ipv4.gateway 192.168.1.1

#設定反映
nmcli connection down eth0
nmcli connection up eth0

#確認
nmcli device show eth0

ホスト名変更

hostnamectl set-hostname my_host_name

ネット関係のコマンド(ifconfig,nslookupなど)を入れる

yum install -y net-tools bind-utils

killallがないので入れる

yum install -y psmisc

NTPクライアントを入れる

yum install chrony
systemctl start chronyd
systemctl enable chronyd

NFSのNASをマウントする

#NFSクライアントインストール
yum -y install nfs-utils
#設定
echo /etc/fstab >> "server:/hoge /mnt/hoge nfs defaults 0 0
#マウント
mount -a

LDAPでOSユーザ認証できるようにする

#インストール
yum install -y pam_ldap nscd nss-pam-ldapd
#設定
authconfig-tui
#[Use LDAP] にチェックを入れる。
#[Use LDAP Authentication] にチェックを入れる。
# base dc=hoge,dc=var
# uri ldap://ldapserver/

systemctlでbashの補完をきかせる

yum install bash-completion
wget https://github.com/terralinux/systemd/raw/master/src/systemctl-bash-completion.sh -O /etc/bash_completion.d/systemctl-bash-completion.sh

これでsystemctlと打ってでtabを押すと以下のようにコマンドを補完してくれるようになる。

[root@localhost]# systemctl [TAB]
cancel                 dot                    is-active              load                   reset-failed           status
condrestart            dump                   is-enabled             poweroff               restart                stop
daemon-reexec          emergency              isolate                reboot                 set-environment        try-restart
daemon-reload          enable                 kexec                  reload                 show                   unset-environment
default                exit                   kill                   reload-or-restart      show-environment
delete                 force-reload           list-jobs              reload-or-try-restart  snapshot
disable                halt                   list-units             rescue                 start

OS起動時にプログレッシブバーではなく詳細ログが出るようにする

GRUB2設定元ネタファイル/etc/default/grubGRUB_CMDLINE_LINUXからrhgbquietのオプションを抜く

GRUB_TIMEOUT=5
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/swap vconsole.font=latarcyrheb-sun16 vconsole.keymap=jp106 rd.
lvm.lv=centos/root crashkernel=auto "  #ここからrhgbとquietを抜く 
GRUB_DISABLE_RECOVERY="true"

GRUB2の設定ファイルを生成する

# grub2-mkconfig -o /boot/grub2/grub.cfg
171
192
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
171
192