阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

CentOS使用yum源中自带的rpm包安装LAMP环境

186次阅读
没有评论

共计 2610 个字符,预计需要花费 7 分钟才能阅读完成。

CentOS 使用 yum 源中自带的 rpm 包安装 LAMP 环境。这是 Linux 下安装 LAMP 的环境一种最基本最简便的方式。新手可以从容安装使用。

1. 安装基础包(可选安装)
yum install -y wget zip unzip gzip
yum install -y Python ruby perl
yum install -y gc gcc gcc-c++

2. 安装 php 及其相关组件
yum install -y php php-gd
yum install -y php-mbstring php-mcrypt php-MySQL php-pdo

3. 启动 httpd 服务器
service httpd start
chkconfig httpd on 设置开机自动启动
服务器 www 目录地址 /var/www/html/

4. 安装 mysql
yum install -y mysql mysql-server
[root@localhost html]# service mysqld start

5. 配置 mysql
根据提示运行
/usr/bin/mysql_secure_installation
按照提示对 mysql 进行配置,包括 root 密码设置等等。
chkconfig mysqld on 设置开机自动启动

6. 安装 phpmyadmin
下载 phpmyadmin 相应版本 https://www.phpmyadmin.net/files/
将 zip 包 copy 到 /var/www/html/ 目录,并解压缩重命名为 phpmyadmin
例如:
wget https://files.phpmyadmin.net/phpMyAdmin/3.5.8.2/phpMyAdmin-3.5.8.2-all-languages.zip
unzip phpMyAdmin-3.5.8.2-all-languages.zip -d /var/www/html/
mv /var/www/html/phpMyAdmin-3.5.8.2-all-languages /var/www/html/phpmyadmin
访问 http://youripaddress/phpmyadmin/ 就可以根据 5. 配置 mysql 中设置的 root 密码登录

7. 防火墙问题
购买的服务器一般镜像安装后都会默认开启 22,80 等常用端口。
自己安装 centos 到特定机器或 vmware 虚拟机安装的时候可能出现 iptables 没有配置导致 80 端口无法访问的问题。
临时禁用 iptables 的方法(重启机器后失效),使用命令 service iptables stop
千万不要在生产环境中这么做!

—————————————————
初次运行 service mysqld start 会有下面的提示,此处做好记录以备以后查看,
对数据库问题修复有至关重要的作用!!
Initializing MySQL database:  Installing MySQL system tables…
OK
Filling help tables…
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password ‘new-password’
/usr/bin/mysqladmin -u root -h localhost.localdomain password ‘new-password’

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

[OK]
Starting mysqld:  [OK]

下面关于 LAMP 相关 的内容你可能也喜欢

LAMP 平台安装 Xcache 和 Memcached 加速网站运行  http://www.linuxidc.com/Linux/2015-06/118835.htm 

CentOS 7 下搭建 LAMP 平台环境  http://www.linuxidc.com/Linux/2015-06/118818.htm

CentOS 6.5 系统安装配置 LAMP(Apache+PHP5+MySQL)服务器环境 http://www.linuxidc.com/Linux/2014-12/111030.htm

Ubuntu 14.04 配置 LAMP+phpMyAdmin PHP(5.5.9)开发环境  http://www.linuxidc.com/Linux/2014-10/107924.htm

Ubuntu 14.10 下安装 LAMP 服务图文详解  http://www.linuxidc.com/Linux/2014-12/110082.htm

LAMP 结合 NFS 构建小型博客站点  http://www.linuxidc.com/Linux/2015-08/121029.htm

更多 CentOS 相关信息见CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14

本文永久更新链接地址:http://www.linuxidc.com/Linux/2015-08/121753.htm

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-20发表,共计2610字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中