CentOS 8.2 服务器上yum安装Apache+Php+MariaDB+MongoDB

在CentOS 8.2 服务器上使用yum安装前先更新yum源,然后,开始准备安装Apache, PHP, MariaDB以及php连接mysql库组件。

CentOS源更新

$ wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
$ yum makecache
$ sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo

MongoDB的源更新

在/etc/yum.repos.d 创建一个mongodb-org.repo源文件

$ vi /etc/yum.repos.d/mongodb-org.repo
# 添加内容如下:(配置偶数版本,奇数版不适合生产使用)

[mongodb-org] 
name = MongoDB Repository
baseurl = https://mirrors.aliyun.com/mongodb/yum/redhat/$releasever/mongodb-org/4.4/x86_64/
gpgcheck = 1 
enabled = 1 
gpgkey = https://www.mongodb.org/static/pgp/server-4.4.asc

1、安装Apache, PHP, MariaDB以及php连接mysql库组件。

$ yum -y install php httpd mariadb mariadb-server mod_perl mod_ssl

# 选择性安装需要php扩展组件
$ yum -y install php-devel php-mysqlnd php-opcache php-pdo php-xml php-xmlrpc php-gd php-mbstring php-bcmath php-embedded php-fpm php-ldap php-tidy

# 配置启动Apache+Mariadb

$ systemctl start httpd.service        #[启动httpd服务]
$ systemctl enable httpd.service       #[设置httpd服务开机启动]

$ systemctl start mariadb.service      #[启动mysql服务]
$ systemctl enable mariadb.service     #[设置mysql服务开机启动]

2、初始化MongoDB数据库

$ mysql_secure_installation            
# Enter current password for root (enter for none): 
# 初次运行直接回车
# [回车,设置root密码,后面的都输Y,关闭远程访问,去除test数据库等]

3、安装MongoDB

$ yum -y install mongodb-org

$ systemctl start mongodb.service       #[启动mongodb服务]
$ systemctl enable mongodb.service      #[设置mongodb服务开机启动]

4、清除更新缓存文件

$ yum clean all

# 重启服务器
$ shutdown -r now

删除默认首页:

/usr/share/httpd/noindex/

相关文章:

1、CentOS 7.x 系统yum环境搭建PHP 7.x + Apache 2.4 + MariaDB 10.x
https://www.onexin.net/solution/centos-7-x-php-7-x-apache-2-4-mariadb-10-x/

2、Centos php升级由5.1.x到5.2.x
https://www.onexin.net/solution/centos-php-update-from-the-5-1-x-to-5-2-x/

3、CentOS 5.5上安装Apache+Php+Mysql+phpMyAdmin+Zend
https://www.onexin.net/solution/centos-5-5-install-apache-php-mysql-phpmyadmin-zend/

4、CentOS 5.3快速搭建Apache+PHP5+MySQL完美Web服务器(LAMP)
https://www.onexin.net/solution/centos-5-3-quickly-build-the-perfect-apache-php5-mysql-web-server-lamp/

5、centos5.2安装+apache+php+mysql+gd+zend+phpmyadmin
https://www.onexin.net/solution/apache/centos5-2-e5-ae-89-e8-a3-85apachephpmysqlgdzendphpmyadmin/

转载请注明出处:https://www.onexin.net/latest/centos-8-2-yum-apache-php-mariadb-mongodb/

Leave a Reply

Your email address will not be published. Required fields are marked *