1. Install Centos 6 minial
Tải về vài cài đặt bản centos 6 theo link http://isoredirect.centos.org/centos/6/isos/x86_64/.Minial là phiên bản không có UI, tương tác chỉ qua text mode.
2. Install Apache
*** Thao khảo thêm ở đây: http://www.servermom.org/complete-newbie-guide-to-build-centos-server-to-host-websites/
Code: yum install httpd3. Install PHP
*** Tham khảo thêm ở đây: https://www.mojowill.com/geek/howto-install-php-5-4-5-5-or-5-6-on-centos-6-and-centos-7/
Code:
yum install php
- Mặc định chỉ cài được php 5.3, nếu muốn cái php version khác, làm theo hướng dẫn:
Code:
wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
+ Mở file /etc/yum.repos.d/remi.repo
Code: vi /etc/yum.repos.d/remi.repo
+ Chú ý đến các nhóm từ [remi-PHP*]. Nếu muốn cài PHP 5.5, tìm đến dòng [remi-php55], đổi enable=1, Các dòng [remi-php*] khác, enable=0
+ Install PHP
Code: yum install php
+ Install extension PHP
Code: yum install php-gd php-mysql php-mcrypt
Nếu không cài được php-gd, dùng lệnh: yum install php-gd --enablerepo=remi,remi-php55
Nếu không cài được php-gd, dùng lệnh: yum install php-gd --enablerepo=remi,remi-php55
4. Install Mysql
Code: yum install mysql-server
Mặc định mysql 5.1 được cài. Cách cài bản mysql mới nhất.
Code:
yum localinstall http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
yum install mysql-community-server
/usr/bin/mysql_secure_installation
- Start mysql, httpd
service httpd restart
service mysqld restart
5. Config Apache
- Rewrite mode:
edit file /etc/httpd/conf/httpd.conf, tìm , thay đổi AllowOverride All. Thêm DocumentRoot khác với tham số tương tự.
- Add vhost file:
+ thêm vào cuối file /etc/httpd/conf/httpd.conf dòng: Include sites-enabled/*.conf
+ Thêm folder sites-enabled: mkdir /etc/httpd/sites-enabled
+ Thêm file vhost: webserver.conf: vi /etc/httpd/sites-enabled/webserver.conf và sửa, ví dụ:
NameVirtualHost *:80
ServerName domain.com
DocumentRoot /var/www/html/folder.domain
+ Nếu trong file config httpd httpd.conf có NameVirtualHost rồi thì không cần phải thêm trong file này.
+ Thêm hosts: thêm 127.0.0.1 domain.com vào file /etc/hosts
6. Remote apache từ máy khác (trong mạn LAN)
- Cài openssh mới remote ssh đươc với máy centos (openssh-server, openssh-client)
- Máy remote gõ địa chỉ url để truy cập được website máy Centos:
Máy remote config hosts: 192.168.15.3 domain.com với 192.168.15.3 là ip máy Centos
Máy Centos tắt tường lửa: service iptables stop
0 comments:
Post a Comment