LoginSignup
1
5

More than 5 years have passed since last update.

CentOS7構築手順

Last updated at Posted at 2018-07-10

動作確認のためにCentOS7を構築する際、毎回インターネットで検索しながら環境構築していたので、自分の備忘録として記載。

環境は以下

  • Windows10 Enterprise
    • プロセッサ:Corei7 6600U @ 2.60GHz 2.81GHz
    • 実装メモリ(RAM):8.00GB
    • OS種:64bit
  • VMware(R) Workstation 12 Player
    • 12.5.7 build-5813279
  • CentOS7

インストール

詳細は省略。
環境に合わせて仮想マシンを設定。
サウンドカード、フロッピー、プリンターなどは使わないのでこの時点で削除。
インターネットに到達性を持たせるため、ネットワークはNATを選択。
※Minimalインストールとする。

インストール完了~SSH接続

コンソール画面ではいろいろめんどくさいので、ターミナルソフトからSSHでログイン。

net-toolsをインストール

CentOS7では、初期状態だと"ifconfig"や"netstat"などのコマンドが入っていないのでインストールする。
※非推奨コマンドになったので、今後なくなる可能性あり。

yum install net-tools

※補足
よく使うコマンドの置き換わりは下記

ifconfig = ip addr
arp = ip nei
route = ip route
netstat = ss

パッケージを最新にアップデート

パッケージをすべて最新に

yum update

selinuxの無効化

検証目的のため、動作に影響を与えないように無効化

vi /etc/selinux/config
/etc/selinux/config
SELINUX=disabled

SELINUX=enforcingdisabledに変更する

編集後、サーバを再起動

確認コマンド

# getenforce
Disabled

'Disabled'と応答があればOK

bash-completionをインストール

systemctlコマンドでtab補完ができるようにbash-completionをインストール

yum install bash-completion

時刻同期

デフォルトだと時刻同期していないのでchronyをインストール
※chrony...CentOS7から導入されたntp兼サーバ

yum install chrony.x86_64

chronyを起動し状況を確認

systemctl start chronyd
systemctl status chronyd

時刻同期先を設定

vi /etc/chrony.conf
/etc/chrony.conf
#server 0.CentOS.pool.ntp.org iburst
#server 1.CentOS.pool.ntp.org iburst
#server 2.CentOS.pool.ntp.org iburst
#server 3.CentOS.pool.ntp.org iburst
server ntp2.jst.mfeed.ad.jp iburst

※インターネットの時刻同期サーバを記載

サービス再起動

systemctl restart chronyd

自動起動設定

systemctl enable chronyd

時刻同期確認

chronyc sources
timedatectl

locateコマンドのインストール

ファイル検索用にlocateコマンドをインストール

yum install mlocate
updatedb

Python3.6のインストール

IUSというリポジトリを追加

yum install -y https://centos7.iuscommunity.org/ius-release.rpm

python3のバージョンを検索

yum search python35
yum search python36

最新の3.x系は3.6なので3.6をインストール

yum install python36u python36u-libs python36u-devel python36u-pip
yum install python-pip #python2

※必要そうなものを入れる

Gitコマンドのインストール

yum install git
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker

思いついたら追記

1
5
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
1
5