首页 > 系统 > CentOS > 正文

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

2024-06-28 13:19:13
字体:
来源:转载
供稿:网友
CentOS使用yum源中自带的rpm包安装LAMP环境

CentOS使用yum源中自带的rpm包安装LAMP环境。这是linux下安装LAMP的环境一种最基本最简便的方式。新手可以从容安装使用。1. 安装基础包(可选安装)yum install -y wget zip unzip gzipyum install -y python ruby perlyum install -y gc gcc gcc-c++2. 安装php及其相关组件yum install -y php php-gdyum install -y php-mbstring php-mcrypt php-MySQL php-pdo3. 启动httpd服务器service httpd startchkconfig httpd on 设置开机自动启动服务器www目录地址/var/www/html/4. 安装mysqlyum install -y mysql mysql-server[root@localhost html]# service mysqld start5. 配置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.zipunzip 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...OKFilling help tables...OKTo start mysqld at boot time you have to copysupport-files/mysql.server to the right place for your systemPLEASE 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_installationwhich will also give you the option of removing the testdatabases and anonymous user created by default. This isstrongly 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.plcd /usr/mysql-test ; perl mysql-test-run.plPlease report any problems with the /usr/bin/mysqlbug script![ OK ]Starting mysqld: [ OK ]


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表