centos 7 vmware 설치기
0. 소프트웨어선택에서 그놈데스크탑 선택 전부 체크
1. network 활성화...
재부팅후에도 네트워크 활성화 되도록
vi /etc/sysconfig/network-scripts/ifcfg-ens33
'onboot=no ' 부분을 찾아 onboot=yes로 수정
#systemctl restart network
2. vmware tools 를 설치
./vmware-install.pl
3. centos 7 update
yum -y update && shutdown -r now
3. 아파치 설치
# yum --enablerepo=epel,remi install httpd mod_ssl
# systemctl start httpd
# systemctl enable httpd
# firewall-cmd --permanent --zone=public --add-service=http
# firewall-cmd --permanent --zone=public --add-service=https
# firewall-cmd --reload
4. 아파치 설정
설정파일 vi /etc/httpd/conf/httpd.conf
# cp -av /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.original
# sed -i 's/AddDefaultCharset UTF-8/#AddDefaultCharset UTF-8/' /etc/httpd/conf/httpd.conf
# sed -i 's/DirectoryIndex index.html/DirectoryIndex index.html Index.html Index.php index.php/' /etc/httpd/conf/httpd.conf
# sed -i 's/Options Indexes FollowSymLinks/Options FollowSymLinks/' /etc/httpd/conf/httpd.conf
# echo 'KeepAlive On ServerTokens Prod ' >> /etc/httpd/conf/httpd.conf
# systemctl restart httpd
# systemctl status httpd /* 설치된 상태를 봅니다. */
# systemctl start httpd /* 서비스 가동 명령어 입니다. */
# systemctl enable httpd.service /* 부팅 후 자동 실행 설정 */
5. 아파치 ssl 설정
# sed -i 's/#DocumentRoot "\/var\/www\/html"/DocumentRoot "\/home\/oerun\/public_html"/' /etc/httpd/conf.d/ssl.conf
# sed -i 's/#ServerName www.example.com:443/ServerName www.oerun.com:443/' /etc/httpd/conf.d/ssl.conf
# sed -i 's/SSLCertificateFile \/etc\/pki\/tls\/certs\/localhost.crt/SSLCertificateFile \/etc\/pki\/tls\/certs\/cert_www.oerun.com.crt/' /etc/httpd/conf.d/ssl.conf
# sed -i 's/SSLCertificateKeyFile \/etc\/pki\/tls\/certs\/localhost.key/SSLCertificateKeyFile \/etc\/pki\/tls\/certs\/prv_www.oerun.com.key/' /etc/httpd/conf.d/ssl.conf
# systemctl restart httpd
6. PHP 7 설치
1) 먼저 PHP7 본 패키지를 설치한다.
# yum install php70w
기타 필요한 모듈을 설치한다. yum search php70w 명령으로 설치할 수 있는 모듈을 찾아볼 수 있다.
# yum install php70w-cli php70w-common php70w-dba php70w-devel php70w-fpm php70w-gd php70w-imap
# yum install php70w-ldap php70w-mbstring php70w-mcrypt php70w-mysqlnd php70w-odbc php70w-opcache
# yum install php70w-pdo php70w-pdo_dblib php70w-pear php70w-pecl-imagick php70w-pecl-imagick-devel
# yum install php70w-pgsql php70w-phpdbg php70w-process php70w-snmp php70w-soap php70w-tidy php70w-xml php70w-xmlrpc
2) 다른 방법
yum install -y epel-release
rpm -ivh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum --enablerepo=remi update remi-release
yum --enablerepo=remi-php70 install -y php php-fpm php-mysql php-cli php-common php-dba php-devel php-gd php-imap
yum --enablerepo=remi-php70 install -y php-ldap php-mbstring php-mcrypt php-mysqlnd php-odbc php-opcache
yum --enablerepo=remi-php70 install -y php-pdo php-pdo_dblib php-pear php-pecl-imagick php-pecl-imagick-devel
yum --enablerepo=remi-php70 install -y php-pgsql php-phpdbg php-process php-snmp php-soap php-tidy php-xml php-xmlrpc
(php 7.1.x 설치 yum --enablerepo=remi-php71 install -y php php-fpm php-mysql)
7. php 설정
# cp -av /etc/php.ini /etc/php.ini.original
# sed -i 's/short_open_tag = Off/short_open_tag = On/' /etc/php.ini
# sed -i 's/expose_php = On/expose_php = Off/' /etc/php.ini
# sed -i 's/display_errors = Off/display_errors = On/' /etc/php.ini
# sed -i 's/;error_log = php_errors.log/error_log = php_errors.log/' /etc/php.ini
# sed -i 's/error_reporting = E_ALL \& ~E_DEPRECATED/error_reporting = E_ALL \& ~E_NOTICE \& ~E_DEPRECATED \& ~E_USER_DEPRECATED/' /etc/php.ini
# sed -i 's/variables_order = "GPCS"/variables_order = "EGPCS"/' /etc/php.ini
# sed -i 's/post_max_size = 8M/post_max_size = 100M/' /etc/php.ini
# sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 100M/' /etc/php.ini
# sed -i 's/;date.timezone =/date.timezone = "Asia\/Seoul"/' /etc/php.ini
# sed -i 's/session.gc_maxlifetime = 1440/session.gc_maxlifetime = 86400/' /etc/php.ini
# systemctl restart httpd
# echo '<?
echo __FILE__;
phpinfo();
?>' >> /var/www/html/phpinfo.php
# echo "<?php phpinfo(); ?>" > /var/www/html/info.php /* php 정보 출력 페이지 생성 */
# chmod 777 /var/lib/php/session/ /* 그리고 세션 사용을 오픈 해야 됩니다. 셔센은 로그인 할때에 많이 사용하게 됩니다. */
# systemctl restart httpd
출처: http://blog.kgoon.net/14 [Kgoon]
브라우저에서 http://서버IP/phpinfo.php 실행하면 php 정보가 출력된다.
8. MariaDB 설치
설치 전, 아래 주소에 접속하여 원하는 버전을 선택하여 저장소 파일을 만든다.
https://downloads.mariadb.org/mariadb/repositories/#mirror=kaist&distro=CentOS&distro_release=centos7-amd64--centos7&version=10.1
# echo '# MariaDB 10.1 CentOS repository list - created 2016-10-13 00:14 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
' >> /etc/yum.repos.d/MariaDB.repo
# yum install MariaDB-server MariaDB-client
# systemctl restart mysql
# mysql_secure_installation
# systemctl restart mysql
# firewall-cmd --permanent --zone=public --add-service=mysql
# firewall-cmd --reload
# mysql -u root -p
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'DB암호' WITH GRANT OPTION;
# systemctl restart mysql
9. MariaDB 설정
# rpm -ql MariaDB-server.x86_64 | grep cnf
* 환경설정 파일이 어디 있는지 확인
# mv /etc/my.cnf /etc/my.cnf.original
# cp -f /usr/share/mysql/my-huge.cnf /etc/my.cnf
10. InnoDB로 사용하기
# cp -f /usr/share/mysql/my-innodb-heavy-4G.cnf /etc/my.cnf
# sed -i 's/\[mysqld\]/\[mysqld\]\ntransaction-isolation = READ-COMMITTED/' /etc/my.cnf
# sed -i 's/\[mysqld\]/\[mysqld\]\nlog-bin-trust-function-creators = 1/' /etc/my.cnf
# sed -i 's/\[mysqld\]/\[mysqld\]\nlower_case_table_names = 1/' /etc/my.cnf
# sed -i 's/\[mysqld\]/\[mysqld\]\nexpire_logs_days = 5/' /etc/my.cnf
# sed -i 's/\[mysqld\]/\[mysqld\]\nwait_timeout = 90000/' /etc/my.cnf
# sed -i 's/max_allowed_packet = 16M/max_allowed_packet = 128M/' /etc/my.cnf
# sed -i 's/default-storage-engine = MYISAM/default-storage-engine = InnoDB/' /etc/my.cnf
# sed -i 's/transaction_isolation = REPEATABLE-READ/transaction_isolation = READ-COMMITTED/' /etc/my.cnf
# sed -i 's/log-bin=mysql-bin/#log-bin=mysql-bin/' /etc/my.cnf
# sed -i 's/long_query_time = 2/long_query_time = 3/' /etc/my.cnf
# sed -i 's/innodb_buffer_pool_size = 2G/innodb_buffer_pool_size = 24G/' /etc/my.cnf
# sed -i 's/innodb_data_file_path = ibdata1:10M:autoextend/innodb_data_file_path = ibdata1:2000M;ibdata2:2000M;ibdata3:2000M:autoextend/' /etc/my.cnf
# sed -i 's/innodb_flush_log_at_trx_commit = 1/innodb_flush_log_at_trx_commit = 0/' /etc/my.cnf
# sed -i 's/innodb_log_file_size = 256M/innodb_log_file_size = 4G/' /etc/my.cnf
11.MariaDB를 UTF-8로 사용하기
# sed -i 's/\[client\]/\[client\]\ndefault-character-set = utf8/' /etc/my.cnf
# sed -i 's/\[mysqld\]/\[mysqld\]\ncharacter-set-client-handshake = FALSE\ninit_connect = \"SET collation_connection = utf8_general_ci\"\ninit_connect = \"SET NAMES utf8\"\ncharacter-set-server = utf8\ncollation-server = utf8_general_ci/' /etc/my.cnf
# sed -i 's/\[mysqldump\]/\[mysqldump\]\ndefault-character-set = utf8/' /etc/my.cnf
# sed -i 's/\[mysql\]/\[mysql\]\ndefault-character-set = utf8/' /etc/my.cnf
# systemctl restart mysql
12. 설치된 버전 확인
# php -v
PHP 7.0.6 (cli) (built: May 1 2016 10:24:20) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built: Nov 19 2015 21:43:13
# mysql -V
mysql Ver 15.1 Distrib 10.1.14-MariaDB, for Linux (x86_64) using readline 5.1
13 . phpMyAdmin 4.6.1 설치
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
# yum --enablerepo=remi,remi-test install -y phpMyAdmin
# cp -a /etc/httpd/conf.d/phpMyAdmin.conf /etc/httpd/conf.d/phpMyAdmin.conf.original
# sed -i 's/Alias \/phpMyAdmin/Alias \/phpMyAdmin/' /etc/httpd/conf.d/phpMyAdmin.conf
# sed -i 's/Alias \/phpmyadmin/Alias \/phpmyadmin/' /etc/httpd/conf.d/phpMyAdmin.conf
# sed -i '15,17s/Require local/Require all granted/' /etc/httpd/conf.d/phpMyAdmin.conf
# systemctl restart httpd
* 접속 URL : http://서버IP/phpmyadmin
14. 방화벽 내리기.
#systemctl status httpd
#systemctl status mysqld
# systemctl start httpd
# systemctl start mysqld
# systemctl enable httpd
# systemctl enable mysqld
# firewall-cmd --permanent --zone=public --add-service=http
# firewall-cmd --permanent --zone=public --add-service=https
# firewall-cmd --permanent --zone=public --add-service=mysql
# firewall-cmd --reload
15. SELinux 끄기
# setenforce 0
# sestatus
#gedit /etc/sysconfig/selinux
SELINUX=enforcing 을 SELINUX=disabled 로 변경후 저장한다.
#reboot
0. 소프트웨어선택에서 그놈데스크탑 선택 전부 체크
1. network 활성화...
재부팅후에도 네트워크 활성화 되도록
vi /etc/sysconfig/network-scripts/ifcfg-ens33
'onboot=no ' 부분을 찾아 onboot=yes로 수정
#systemctl restart network
2. vmware tools 를 설치
./vmware-install.pl
3. centos 7 update
yum -y update && shutdown -r now
3. 아파치 설치
# yum --enablerepo=epel,remi install httpd mod_ssl
# systemctl start httpd
# systemctl enable httpd
# firewall-cmd --permanent --zone=public --add-service=http
# firewall-cmd --permanent --zone=public --add-service=https
# firewall-cmd --reload
4. 아파치 설정
설정파일 vi /etc/httpd/conf/httpd.conf
# cp -av /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.original
# sed -i 's/AddDefaultCharset UTF-8/#AddDefaultCharset UTF-8/' /etc/httpd/conf/httpd.conf
# sed -i 's/DirectoryIndex index.html/DirectoryIndex index.html Index.html Index.php index.php/' /etc/httpd/conf/httpd.conf
# sed -i 's/Options Indexes FollowSymLinks/Options FollowSymLinks/' /etc/httpd/conf/httpd.conf
# echo 'KeepAlive On ServerTokens Prod ' >> /etc/httpd/conf/httpd.conf
# systemctl restart httpd
# systemctl status httpd /* 설치된 상태를 봅니다. */
# systemctl start httpd /* 서비스 가동 명령어 입니다. */
# systemctl enable httpd.service /* 부팅 후 자동 실행 설정 */
5. 아파치 ssl 설정
# sed -i 's/#DocumentRoot "\/var\/www\/html"/DocumentRoot "\/home\/oerun\/public_html"/' /etc/httpd/conf.d/ssl.conf
# sed -i 's/#ServerName www.example.com:443/ServerName www.oerun.com:443/' /etc/httpd/conf.d/ssl.conf
# sed -i 's/SSLCertificateFile \/etc\/pki\/tls\/certs\/localhost.crt/SSLCertificateFile \/etc\/pki\/tls\/certs\/cert_www.oerun.com.crt/' /etc/httpd/conf.d/ssl.conf
# sed -i 's/SSLCertificateKeyFile \/etc\/pki\/tls\/certs\/localhost.key/SSLCertificateKeyFile \/etc\/pki\/tls\/certs\/prv_www.oerun.com.key/' /etc/httpd/conf.d/ssl.conf
# systemctl restart httpd
6. PHP 7 설치
1) 먼저 PHP7 본 패키지를 설치한다.
# yum install php70w
기타 필요한 모듈을 설치한다. yum search php70w 명령으로 설치할 수 있는 모듈을 찾아볼 수 있다.
# yum install php70w-cli php70w-common php70w-dba php70w-devel php70w-fpm php70w-gd php70w-imap
# yum install php70w-ldap php70w-mbstring php70w-mcrypt php70w-mysqlnd php70w-odbc php70w-opcache
# yum install php70w-pdo php70w-pdo_dblib php70w-pear php70w-pecl-imagick php70w-pecl-imagick-devel
# yum install php70w-pgsql php70w-phpdbg php70w-process php70w-snmp php70w-soap php70w-tidy php70w-xml php70w-xmlrpc
2) 다른 방법
yum install -y epel-release
rpm -ivh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum --enablerepo=remi update remi-release
yum --enablerepo=remi-php70 install -y php php-fpm php-mysql php-cli php-common php-dba php-devel php-gd php-imap
yum --enablerepo=remi-php70 install -y php-ldap php-mbstring php-mcrypt php-mysqlnd php-odbc php-opcache
yum --enablerepo=remi-php70 install -y php-pdo php-pdo_dblib php-pear php-pecl-imagick php-pecl-imagick-devel
yum --enablerepo=remi-php70 install -y php-pgsql php-phpdbg php-process php-snmp php-soap php-tidy php-xml php-xmlrpc
(php 7.1.x 설치 yum --enablerepo=remi-php71 install -y php php-fpm php-mysql)
7. php 설정
# cp -av /etc/php.ini /etc/php.ini.original
# sed -i 's/short_open_tag = Off/short_open_tag = On/' /etc/php.ini
# sed -i 's/expose_php = On/expose_php = Off/' /etc/php.ini
# sed -i 's/display_errors = Off/display_errors = On/' /etc/php.ini
# sed -i 's/;error_log = php_errors.log/error_log = php_errors.log/' /etc/php.ini
# sed -i 's/error_reporting = E_ALL \& ~E_DEPRECATED/error_reporting = E_ALL \& ~E_NOTICE \& ~E_DEPRECATED \& ~E_USER_DEPRECATED/' /etc/php.ini
# sed -i 's/variables_order = "GPCS"/variables_order = "EGPCS"/' /etc/php.ini
# sed -i 's/post_max_size = 8M/post_max_size = 100M/' /etc/php.ini
# sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 100M/' /etc/php.ini
# sed -i 's/;date.timezone =/date.timezone = "Asia\/Seoul"/' /etc/php.ini
# sed -i 's/session.gc_maxlifetime = 1440/session.gc_maxlifetime = 86400/' /etc/php.ini
# systemctl restart httpd
# echo '<?
echo __FILE__;
phpinfo();
?>' >> /var/www/html/phpinfo.php
# echo "<?php phpinfo(); ?>" > /var/www/html/info.php /* php 정보 출력 페이지 생성 */
# chmod 777 /var/lib/php/session/ /* 그리고 세션 사용을 오픈 해야 됩니다. 셔센은 로그인 할때에 많이 사용하게 됩니다. */
# systemctl restart httpd
출처: http://blog.kgoon.net/14 [Kgoon]
브라우저에서 http://서버IP/phpinfo.php 실행하면 php 정보가 출력된다.
8. MariaDB 설치
설치 전, 아래 주소에 접속하여 원하는 버전을 선택하여 저장소 파일을 만든다.
https://downloads.mariadb.org/mariadb/repositories/#mirror=kaist&distro=CentOS&distro_release=centos7-amd64--centos7&version=10.1
# echo '# MariaDB 10.1 CentOS repository list - created 2016-10-13 00:14 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
' >> /etc/yum.repos.d/MariaDB.repo
# yum install MariaDB-server MariaDB-client
# systemctl restart mysql
# mysql_secure_installation
# systemctl restart mysql
# firewall-cmd --permanent --zone=public --add-service=mysql
# firewall-cmd --reload
# mysql -u root -p
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'DB암호' WITH GRANT OPTION;
# systemctl restart mysql
9. MariaDB 설정
# rpm -ql MariaDB-server.x86_64 | grep cnf
* 환경설정 파일이 어디 있는지 확인
# mv /etc/my.cnf /etc/my.cnf.original
# cp -f /usr/share/mysql/my-huge.cnf /etc/my.cnf
10. InnoDB로 사용하기
# cp -f /usr/share/mysql/my-innodb-heavy-4G.cnf /etc/my.cnf
# sed -i 's/\[mysqld\]/\[mysqld\]\ntransaction-isolation = READ-COMMITTED/' /etc/my.cnf
# sed -i 's/\[mysqld\]/\[mysqld\]\nlog-bin-trust-function-creators = 1/' /etc/my.cnf
# sed -i 's/\[mysqld\]/\[mysqld\]\nlower_case_table_names = 1/' /etc/my.cnf
# sed -i 's/\[mysqld\]/\[mysqld\]\nexpire_logs_days = 5/' /etc/my.cnf
# sed -i 's/\[mysqld\]/\[mysqld\]\nwait_timeout = 90000/' /etc/my.cnf
# sed -i 's/max_allowed_packet = 16M/max_allowed_packet = 128M/' /etc/my.cnf
# sed -i 's/default-storage-engine = MYISAM/default-storage-engine = InnoDB/' /etc/my.cnf
# sed -i 's/transaction_isolation = REPEATABLE-READ/transaction_isolation = READ-COMMITTED/' /etc/my.cnf
# sed -i 's/log-bin=mysql-bin/#log-bin=mysql-bin/' /etc/my.cnf
# sed -i 's/long_query_time = 2/long_query_time = 3/' /etc/my.cnf
# sed -i 's/innodb_buffer_pool_size = 2G/innodb_buffer_pool_size = 24G/' /etc/my.cnf
# sed -i 's/innodb_data_file_path = ibdata1:10M:autoextend/innodb_data_file_path = ibdata1:2000M;ibdata2:2000M;ibdata3:2000M:autoextend/' /etc/my.cnf
# sed -i 's/innodb_flush_log_at_trx_commit = 1/innodb_flush_log_at_trx_commit = 0/' /etc/my.cnf
# sed -i 's/innodb_log_file_size = 256M/innodb_log_file_size = 4G/' /etc/my.cnf
11.MariaDB를 UTF-8로 사용하기
# sed -i 's/\[client\]/\[client\]\ndefault-character-set = utf8/' /etc/my.cnf
# sed -i 's/\[mysqld\]/\[mysqld\]\ncharacter-set-client-handshake = FALSE\ninit_connect = \"SET collation_connection = utf8_general_ci\"\ninit_connect = \"SET NAMES utf8\"\ncharacter-set-server = utf8\ncollation-server = utf8_general_ci/' /etc/my.cnf
# sed -i 's/\[mysqldump\]/\[mysqldump\]\ndefault-character-set = utf8/' /etc/my.cnf
# sed -i 's/\[mysql\]/\[mysql\]\ndefault-character-set = utf8/' /etc/my.cnf
# systemctl restart mysql
12. 설치된 버전 확인
# php -v
PHP 7.0.6 (cli) (built: May 1 2016 10:24:20) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built: Nov 19 2015 21:43:13
# mysql -V
mysql Ver 15.1 Distrib 10.1.14-MariaDB, for Linux (x86_64) using readline 5.1
13 . phpMyAdmin 4.6.1 설치
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
# yum --enablerepo=remi,remi-test install -y phpMyAdmin
# cp -a /etc/httpd/conf.d/phpMyAdmin.conf /etc/httpd/conf.d/phpMyAdmin.conf.original
# sed -i 's/Alias \/phpMyAdmin/Alias \/phpMyAdmin/' /etc/httpd/conf.d/phpMyAdmin.conf
# sed -i 's/Alias \/phpmyadmin/Alias \/phpmyadmin/' /etc/httpd/conf.d/phpMyAdmin.conf
# sed -i '15,17s/Require local/Require all granted/' /etc/httpd/conf.d/phpMyAdmin.conf
# systemctl restart httpd
* 접속 URL : http://서버IP/phpmyadmin
14. 방화벽 내리기.
#systemctl status httpd
#systemctl status mysqld
# systemctl start httpd
# systemctl start mysqld
# systemctl enable httpd
# systemctl enable mysqld
# firewall-cmd --permanent --zone=public --add-service=http
# firewall-cmd --permanent --zone=public --add-service=https
# firewall-cmd --permanent --zone=public --add-service=mysql
# firewall-cmd --reload
15. SELinux 끄기
# setenforce 0
# sestatus
#gedit /etc/sysconfig/selinux
SELINUX=enforcing 을 SELINUX=disabled 로 변경후 저장한다.
#reboot