3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

WindowsユーザのCentOS(7.3)環境構築メモ

Last updated at Posted at 2017-12-23

ある日windows updateをした(させられた)ら以前使っていた開発環境が壊れてしまったのでやむなく1からサーバーを構築する事に。次同じことがあってもスムーズに進められるようにメモを残す。

使用環境

  • Oracle VM VirtualBox (5.2.4)
  • Vagrant (2.0.1)
  • bento/centos-7.3
  • PUTTY
  • WinSCP

vagrant up で仮想OS組み立てるとこまでは下記リンクを参考にしました。
ドットインストール ~ローカル開発環境の構築[Windows編]~

※ほとんどのコマンドでsudoが必要になりますが冗長になるので省略します。

初期化

yum clean all
yum -y update

HTTPサーバ

HTTPサーバプログラムをインストール

yum -y install httpd

仮想OS起動と同時にHTTPサーバ起動

systemctl enable httpd

Ruby

こちらのバージョンマネージャをインストール
rbenv/rbenv

git clone https://github.com/sstephenson/rbenv.git ~/.rbenv

rbenvを標準コマンドとして定義

/home/vagrant/.bash_profile
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

Ruby最新版をインストール(2017年12月23日現在)

rbenv install -l
rbenv install 2.4.3
rbenv rehash

Ruby最新版を標準コマンドから動かせるように設定

rbenv global 2.4.3

PHP

インストール(MySQLマネージャも同時に)

yum -y install php php-mysql

Node.js

こちらの専用バージョンマネージャをインストール
creationix/nvm

wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash

nvmを標準コマンドとして定義

/home/vagrant/.bash_profile
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"

Node.jsの最新版をインストール

nvm ls-remote --lts #リリースされているバージョンをリストアップ
nvm install v8.9.3

Git

Gitをインストール

yum install git

GitHubにコミットする為に必要な秘密・公開鍵を生成

ssh-keygen -t rsa -C 'yourmail@domain'
ssh-add ~/.ssh/id_rsa

~/.ssh/id_rsa.pub 中に記述されている公開鍵を自分のGitHubアカウントに登録
(コピペ)

MySQL

MySQLパッケージをインストール

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-server

仮想OS起動と同時にMySQLサーバを起動

systemctl enable mysqld

PostgreSQL

こちらを参照
Linux downloads
パッケージをインストール

yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-1.noarch.rpm
yum install postgresql10
yum install postgresql10-server

仮想OS起動と同時にPostgreSQLサーバを起動

/usr/pgsql-10/bin/postgresql-10-setup initdb
systemctl enable postgresql-10
systemctl start postgresql-10

デスクトップ環境

必要なパッケージ群をインストール

yum groupinstall 'Development Tools'
yum -y install openssl-devel readline-devel zlib-devel
yum groupinstall 'GNOME Desktop'

起動時にデスクトップGUIを立ち上げる

/home/vagrant/.bash_profile
if [ -z "$DISPLAY" ] && [ -n "$XDG_VTNR" ] && [ "$XDG_VTNR" -eq 1 ]; then
  exec startx
fi

google chrome

CentOS上でUIを使ったテストに必要なため導入
こちらを参照
Google Chrome 63 Released – Install on RHEL/CentOS 7 and Fedora 26-20

リポジトリファイル(?)を作成

/etc/yum.repos.d/google-chrome.repo
[google-chrome]
name=google-chrome
baseurl=http://dl.google.com/linux/chrome/rpm/stable/$basearch
enabled=1
gpgcheck=1
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub

chromeの最新版が利用可能か確認

yum info google-chrome-stable

chromeをインストール

yum install google-chrome-stable
3
3
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
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?