Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chihirokaasan/49864acfde7502040779 to your computer and use it in GitHub Desktop.
Save chihirokaasan/49864acfde7502040779 to your computer and use it in GitHub Desktop.
CentOS7 LAMP+MongoDB3.2環境構築
● MongoDBインストール
yum install mongodb-org
●自働起動
chkconfig mongod on
●epelリポジトリ
yum install -y epel-release
●wget インストチェック
yum list | grep wget
●wgetでremiリポジトリ取得
wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
●インスト実行
rpm -Uvh remi-release-7.rpm
●epelインスト
yum install -y epel-release
●mysql公式リポジトリ 追加とインストール
yum -y install http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
rpm -Uvh mysql-community-release-el7-5.noarch.rpm
●MARIA DB アンインスト
yum -y remove mariadb
yum -y remove mariadb-libs
●MySQLリポジトリの設定
[mysql-connectors-community]
enabled=1
↓変更
enabled=0
[mysql-tools-community]
enabled=1
↓変更
enabled=0
[mysql56-community]
:(略)
enabled=1
↓変更
enabled=0
●MySQLインスト
yum --enablerepo=mysql56-community install mysql-community-server
●MySQLインスト自働起動チェック
systemctl is-enabled mysqld.service
enabled
●もしdisabledだったら自働起動にする
systemctl enable mysqld.service
●MySQLバージョンチェック
mysqld -V
mysqld Ver 5.6.29 for Linux on x86_64 (MySQL Community Server (GPL))
mysqld Ver 5.6.29 for Linux on x86_64 (MySQL Community Server (GPL))
●MySQLにrootパスワード設定
mysql -u root
●MySQL起動
systemctl start mysqld
●DB初期設定
# /usr/bin/mysql_secure_installation
1. Enter current password for root (enter for none): ← [Enter]
2. Set root password? [Y/n] ← 「Enter] rootのパスワード設定
New Password: ← パスワード入力
Re-enter new password: ← パスワード再入力
3. Remove anonymous users? [Y/n] ← 「Enter] 匿名ユーザ削除
4. Disallow root login remotely? [Y/n] ← [Enter] リモートからのrootログイン禁止
5. Remove test database and access to it? [Y/n] ← [Enter] テスト用データベースを削除
6. Reload privilege tables now? [Y/n] ← [Enter] 設定反映
● MySQLの文字コードをUTF-8に変更
# vi /etc/my.cnf
[mysqld]の最下行に以下を追加
character_set_server=utf8
skip-character-set-client-handshake
● MySQL再起動
# systemctl restart mysqld
● php本体とその他module類
yum install --enablerepo=remi --enablerepo=remi-php56 php gcc php-pear php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof
pecl install -f ssh2 gcc php-pear php-devel php-common libmcrypt-devel libaio libaio-devel libmcrypt libtidy openssl-devel perl-DBI
php -v
PHP 5.6.18 (cli) (built: Feb 3 2016 13:07:14)
● composer インスト
curl -sS https://getcomposer.org/installer | php
● お好みでcomposer移動しとく
mv /etc/yum.repos.d/composer.phar /usr/local/bin/composer
#さらにphp module追加
#yum install --enablerepo=epel,remi libmcrypt-devel libaio libaio-devel libmcrypt libtidy openssl-devel perl-DBI
● mongo系のmoduleインスト
pecl install mongo
● mongoModule の拡張をphp.iniに追加
# vi /etc/php.ini
-----------------
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
extension=mongo.so
---------------
● httpd.conf変更したら再起動
systemctl restart httpd.service
● httpd.conf設定は書くと長いので省略。ここのCentOS7の設定そのまんま。
http://centossrv.com/apache.shtml
● WEBサイトの公開ディレクトリ作成
/home/user_name/public_html
● WEBサイトの権限変更
chmod 755 /home/user_name/public_html
● http ポート
firewall-cmd --permanent --add-port=80/tcp
● ssl
firewall-cmd --permanent --add-port=443/tcp
● ssh
firewall-cmd --permanent --add-port=22/tcp
● mongoDBのPort解放
#firewall-cmd --permanent --add-port=27017/tcp
● ファイアウォール リロード
#firewall-cmd --reload
● gitインスト
#yum install git git-daemon git-all
● gitversionチェック
# git --version
●public_htmlフォルダに書き込み権限が無かったら
chown -R /home/user_name/public_html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment