centos 6.5 - cai dat webserver - lamp
DESCRIPTION
CentOS 6.5 - Cai Dat Webserver - LAMPTRANSCRIPT
-
http://hocmang.net
HNG DN CI T WEBSERVER TRN CENTOS 6.5
GM APACHE MYSQL PHPMYADMIN
1. Ci t Apache
Ci t gi lin quan
# yum insatll httpd -y
Khi ng dch v
# service httpd start
Cho php mc nh chy khi khi ng
# chkconfig httpd on
c th truy cp webserver t bn ngoi bn phi sa iptables cho php port 80
# vi /etc/sysconfig/iptables
Thm vo dng sau:
-A INPUT -p tcp -m state --state NEW --dport 80 -j ACCEPT
Restart iptables
# service iptables restart
kim tra. bn c th to mt website th mc /var/www/html/ test.
Di y mnh to mt trang c ni dung l hocmang.net
[root@hocmang ~]# vi /var/www/html/index.html
hocmang.net
my client bn ch cn g http://192.168.80.100 l s truy cp c trang web mi to.
-
http://hocmang.net
2. Ci t MySQL
Ci t package lin quan
# yum install mysql mysql-server -y
Khi ng dch v v cho php chy mc nh khi khi ng CentOS
# service mysqld start
# chkconfig mysqld on
t root password
Mc nh khi ci xong user root s khng c mt khu, nu bn mun thit lp mt khu cho user root th lm nh sau:
[root@hocmang ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL
MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP
CAREFULLY!
In order to log into MySQL to secure it, we'll need the
current password for the root user. If you've just installed MySQL,
and
-
http://hocmang.net
you haven't set the root password yet, the password will be
blank, so you should just press enter here.
Enter current password for root (enter for none): OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the
MySQL root user without the proper authorisation.
Set root password? [Y/n] y
New password: #nhp password
Re-enter new password: #nhp li password Password updated successfully!
Reloading privilege tables.. ... Success!
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have a user account
created for them. This is intended only for testing, and to make the
installation
go a bit smoother. You should remove them before moving into
a production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at the root password from
the network.
Disallow root login remotely? [Y/n] y
... Success!
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing, and should be
removed before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database... ... Success! - Removing privileges on test database... ... Success!
-
http://hocmang.net
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your
MySQL installation should now be secure.
Thanks for using MySQL!
3. Ci t PHP
Ci t package lin quan
# yum install php -y
To mt trang php test:
# vi /var/www/html/testphp.php
Khi ng li Apache
# service httpd restart
Kim tra:
my client bn truy cp vo a ch: 192.168.80.100/testphp.php s ti trang web va to.
-
http://hocmang.net
Bn c th ci t gi tin sau h tr tng tc gia MySQL v PHP, cn nu mun ci t tt c cc package lin quan in php th dng yum install php*
# yum install php-mysql -y
3. Ci t phpMyadmin
Mc nh, bn s khng tim thy gi ci t phpMyAdmin trong CentOS official repositories. ci t c gi phpmyadmin bn s ci t thng qua EPEL repository.
Trc tin bn ci t EPEL rpm.
# wget http://epel.mirror.net.in/epel/6/i386/epel-release-6-
8.noarch.rpm
# rpm -Uvh epel-release-6-8.noarch.rpm
Bn 64-bit th c th ci y:
-
http://hocmang.net
# wget http://epel.mirror.net.in/epel/6/x86_64/epel-release-6-
8.noarch.rpm
By gi tin hnh ci t gi phpmyadmin nh bnh thng:
#yum install phpmyadmin -y
kt ni phpMyAdmin t client bn phi allow a ch IP tng ng, bn tin hnh sa file config nh sau
# vi /etc/httpd/conf.d/phpMyAdmin.conf
# b mt s dng
# Apache 2.4 Require ip 127.0.0.1 192.168.80.0/24
Require ip ::1
# Apache 2.2 Order Deny,Allow Deny from All Allow from 127.0.0.1 192.168.80.0/24
Allow from ::1
Chy li dch v httpd
# service httpd restart
my client, bn ch cn g a ch server/phpmyadmin , sau nhp username, password s vo c trang phpMyAdmin.
-
http://hocmang.net
n y th bn ch vic to, xa, sa database bng phpMyAdmin ri.
V c bn th chng ta ci t xong mt webserver gm c Apache, MySQL, phpMyAdmin.
bi tip th mnh s tin hnh ci t Mail Server bng Postfix, Dovecot v Squirrelmail.
HT.