CentOS上安装配置apache+php+mysql

本文详细介绍如何使用yum安装MySQL及必要的PHP扩展,并为MySQL root用户设置密码,确保数据库的安全。此外,还介绍了如何安装phpMyAdmin以方便管理MySQL数据库。

yum install ntp httpd mysql-server php php-mysql php-mbstring rpm-build gcc mysql-devel openssl-devel cyrus-sasl-devel pkgconfig zlib-devel phpMyAdmin pcre-devel openldap-devel postgresql-devel expect libtool-ltdl-devel openldap-servers libtool gdbm-devel pam-devel gamin-devel postfix

yum install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc php-eaccelerator php-magickwand php-magpierss php-mapserver php-mbstring php-mcrypt php-mhash php-mssql php-shout php-snmp php-soap php-tidy curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel

为MySQL root帐户设置密码:

  mysql_secure_installation

  会出现下面的一系列提示:

  root@server1 ~]# 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, well need the current

  password for the root user. If youve just installed MySQL, and

  you havent 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] ENTER

  New password: yourrootsqlpassword

  Re-enter new password: yourrootsqlpassword

  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] ENTER

  ... 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] ENTER

  ... 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] ENTER

  - Dropping test database...

  ... Success!

  - Removing privileges on test database...

  ... Success!

  Reloading the privilege tables will ensure that all changes made so far

  will take effect immediately.

  Reload privilege tables now? [Y/n] ENTER

  ... Success!

  Cleaning up...

  All done! If youve completed all of the above steps, your MySQL

  installation should now be secure.

  Thanks for using MySQL!

  [root@server1 ~]#

安装phpMyAdmin

  phpMyAdmin是一个网络接口,通过它可以管理你的MySQL数据库。

  首先,我们使CentOS系统RPMForge软件库的phpMyAdmin,而不是官方的CentOS 6.2库:

  所以需要导入RPMForge的GPG密钥:

  rpm import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

  x86_64系统:

  yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

  在i386系统:

  yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm

  安装phpmyadmin

  yum install phpmyadmin

安装setuptool吧,可以节省很多系统管理的时间。

#安装setuptool
yum install setuptool
#可以发现执行setup后不全,再安装一个用于系统服务管理
yum install ntsysv
#再安装个防火墙,以及setup中配套的防火墙设置、网络设置
yum install iptables
#安装setup中配套的防火墙设置
yum install system-config-securitylevel-tui
#安装setup中配套的网络设置
yum install system-config-network-tui

转载于:https://my.oschina.net/u/164202/blog/53697

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值