manjaro linux 安装 Apache,MariaDB,PHP(LAMP)

manjaro linux 安装 Apache,MariaDB,PHP(LAMP)

root 身份执行下面的命令

1. 升级系统

pacman -Syu

2. 安装 Apache

升级完后,安装Apache

pacman -S apache

编辑 /etc/httpd/conf/httpd.conf file

nano /etc/httpd/conf/httpd.conf
# 我这里用的nano,你可用其它的编辑器只要能编辑文本就行

找到LoadModule unique_id_module modules/mod_unique_id.so 注释了

[...]
#LoadModule unique_id_module modules/mod_unique_id.so
[...]

保存退出

让Apache 开机启动 然后重启 Apache 服务

systemctl enable httpd
systemctl restart httpd 

然后看看 Apache 服务是否启动成功

systemctl status httpd

Active: active (running) 有这个就意思成功运行

测试一下Apache

创建一个简单的页面

nano /srv/http/index.html

加入下列内容

<html>
 <title>Welcome</title>
  <body>
   <h2> test page</h2>
  </body>
</html>

点击测试http://localhost

3. 安装MariaDB

执行下列命令来安装

pacman -S mysql

然后执行下面的命令

mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
systemctl enable mysqld
systemctl start mysqld
systemctl status mysqld

设置MySQL/MariaDB root user的密码

mysql_secure_installation

执行完后命令会出现下面的内容 按需选择

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
 SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
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): ## Press Enter
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n]## Press Enter
New password:##  Enter password
Re-enter new password:  ## Re-enter password
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB 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]## Press 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]## Press Enter
 ... Success!

By default, MariaDB 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]## Press 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]## Press Enter
 ... Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

4. 安装 PHP

执行安装命令

pacman -S php php-apache

安装完后来编辑/etc/httpd/conf/httpd.conf文件

nano /etc/httpd/conf/httpd.conf

找到下面的行取消注释

[...]
#LoadModule mpm_event_module modules/mod_mpm_event.so
[...]

然后找到LoadModule mpm_prefork_module modules/mod_mpm_prefork.so 一般在刚刚注释的那行下买 没有就在下面加上 有的话就取消注释

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

然后在最后加上下面的几行

LoadModule php7_module modules/libphp7.so
AddHandler php7-script php
Include conf/extra/php7_module.conf

保存退出

测试php

创建test.php

nano /srv/http/test.php

加上下面几行

<?php
 phpinfo();
?>

重启httpd service

systemctl restart httpd

然后打开http://ip-address/test.php

如果看到php的页面就成功

5 安装 phpMyAdmin

执行命令

pacman -S phpmyadmin php-mcrypt

安装完成后编辑php.ini

nano /etc/php/php.ini

取消下列行的注释

[...]
extension=bz2.so
extension=mcrypt.so
extension=mysqli.so
[...]

保存退出

编辑phpMyAdmin的配置文件

nano /etc/httpd/conf/extra/phpmyadmin.conf

加入下列内容

Alias /phpmyadmin "/usr/share/webapps/phpMyAdmin"
 <Directory "/usr/share/webapps/phpMyAdmin">
  DirectoryIndex index.php
  AllowOverride All
  Options FollowSymlinks
  Require all granted
 </Directory>

编辑 Apache的配置文件

nano /etc/httpd/conf/httpd.conf

在最后加入

Include conf/extra/phpmyadmin.conf

保存,退出,重启httpd服务

systemctl restart httpd

测试phpMyAdmin

打开http://IP-Address/phpmyadmin
phpmyadmin测试

原文地址:https://www.cnblogs.com/bgst007/p/12321367.html

时间: 2024-08-25 12:14:46

manjaro linux 安装 Apache,MariaDB,PHP(LAMP)的相关文章

Linux安装配置MariaDB数据库全程详解

MariaDB在很多方面强于MySQL,在Linux下如何安装MariaDB数据库成为大家比较头疼的一个问题,下面用实例为大家讲解下 MariaDB是采用Maria存储引擎的MySQL分支版本,在很多方面强于MySQL,那么在Linux下如何安装MariaDB数据库呢?下面小编就给大家介绍下Linux安装配置MariaDB数据库的方法. 说明: 操作系统:CentOS 5.10 32位 MariaDB版本:mariadb-5.5.33a MariaDB数据库存放目录:/data/mysql 准备

Linux中Apache(http)和LAMP架构(重点)

apache介绍: 世界上使用率最高的网站服务器,最高时可达70%:官方网站:apache.org :80 — 端口 http对应80端口,https对应443端口 LAMP安装说明 ①源码包安装  自定义 开发版本选择方便 效率高 生产环境 安全 稳定 开发环境 局域网(内网) ②二进制包安装 yum命令安装 官方版本比较低 apache三种工作模式: 1.prefork 工作模式(作用:用一个进程处理一个用户请求) 优点:成熟稳定,兼容所有新老模块.同时,不需要担心线程安全的问题. 缺点:一

linux 安装 apache

安装Apache前准备: 一.检查该环境中是否已经存在httpd服务的配置文件,默认存储路径:/etc/httpd/httpd.conf(这是centos预装的Apache的一个ent版本,一般我们安装源代码版的Apache).如果已经存在/etc/httpd/httpd.conf,请先卸载或者关闭centos系统自带的web服务,执行命令:chkconfig  httpd off,再或者把centos自带的httpd服务的80端口改为其他端口,只要不与我们安装的Apache服务的端口冲突就可以

【问题记录】 Linux 安装 apache 遇到的一些问题

以下为linux上安装apache时自己遇到的一些问题,记录在这,以后遇到时也会不定时更新... 一.安装Apache提示APR not found的解决办法 解决方法: 1. 网站 http://apr.apache.org/download.cgi 下载 apr-1.5.1.tar.gz .apr-util-1.5.4.tar.gz 2. 网站 http://www.pcre.org/ 下载 pcre-8.36.tar.gz 3.依次解压.安装 附相关命令: 1 [[email protec

CentOS 7 尝鲜(yum安装apache+mariadb+php+vsftp)

centos7也已经面世有一段时间了,相对于目前主流的centos5和6来说,还算是比较新的,里面的新改动或许让很多人都不怎么习惯. 个人还是比较喜欢追逐新潮滴,本站就是在阿里云上使用Centos7.所有的程序都是使用yum来安装,跟以前最大的区别就在于,我本次使用的数据库不是mysql,而是Centos7默认的Mariadb.由于Mysql被收购,有闭源的风险,并且更新也越来越慢,所以社区在7版本开始不在把Mysql作为系统默认支持的数据库.本来我也去mysql官方网站下了最新的5.6rpm包

CentOS 6.6配置安装(Apache+PHP5+MySQL)LAMP服务器

1.配置防火墙,开启80端口.3306端口 vi /etc/sysconfig/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT :wq! #保存退出   添加好规则后的防火墙配置文件如下图所示: /etc/init.d/iptables restart #重启防火墙

LInux——安装Apache

在安装Apache的httpd的时候经常会遇到: configure: error: APR not found .  Please read the documentation. configure: error: APR-util not found .  Please read the documentation. configure: error: pcre-config for libpcre not found. PCRE is required and available 网上也有

linux 安装apache 2.4.9+php 7.0.28

安装准备工作yum install -y apr- gcc- libpcre- pcre- openssl-*由于系统包中的curl版本低不支持,所以需要手动下载安装wget https://curl.haxx.se/download/curl-7.59.0.tar.gztar -xf curl-7.59.0.tar.gzcd curl-7.59.0./configure make && make installwget ftp://mcrypt.hellug.gr/pub/crypto/

Linux安装Apache报错:Cannot find a valid baseurl for repo: base/7/x86_64解决方案

最近使用CentOS7学习,安装安装Apache时候,使用yum安装Apache报错:本文适合CentOS7和RHEL7 # yum install httpd 出现:cannot find a valid baseurl for repo:base/7/x86_64. 针对这个问题,网上有大量的解决方案,说是网络不通的,比如: 修改: vi /etc/sysconfig/network-scripts/ifcfg-eth0(每个机子都可能不一样,但格式会是"ifcfg-eth数字")