Linux搭建LAMP、LNMP环境;论坛的搭建;

LAMP的介绍:

LAMP 是一个缩写,它指一组通常一起使用来运行动态网站或者服务器的自由软件:
Linux,操作系统;
Apache,网页服务器;
MySQL,数据库管理系统(或者数据库服务器);
PHP 和有時 Perl 或 Python,脚本语言。
虽然这些开放源代码程序本身并不是专门设计成同另几个程序一起工作的,但由于它们的廉价和普遍,这个组合开始流行(大多数 Linux 发行版本捆绑了这些软件)。当一起使用的时候,它们表现的像一个具有活力的解决方案包。 其他的方案包有苹果的 WebObjects(最初是应用服务器),Java/J2EE 和 微软的 .NET 架构。

LAMP 包的脚本组件中包括了 CGI web 接口,它在 90 年代初期变得流行。这个技术允许网页浏览器的用户在服务器上执行一个程序,并且和接受静态的内容一样接受动态的内容。程序员使用脚本语言来创建这些程序因为它们能很容易有效的操作文本流,甚至当这些文本流并非源自程序自身时也是。正是由于这个原因系统设计者经常称这些脚本语言为胶水语言。

LAMP服务的配置

此处搭建LAMP需要使用到论坛的源码包

安装Linux系统(省略)

关闭防火墙

[root@redhat ~]# systemctl stop firewalld.service 

关闭selinux或调整为disable

[root@redhat ~]# vim /etc/selinux/config 
SELINUX=disabled

[root@redhat ~]# setenforce 0

挂载光盘镜像

[root@redhat ~]# mount /dev/sr0 /mnt/
mount: /mnt: WARNING: device write-protected, mounted read-only

安装Apache服务

[root@redhat ~]# yum install httpd -y

安装PHP

[root@redhat ~]# yum install php* -y

安装数据库(使用mariadb)

[root@redhat ~]# yum install mariadb-server -y

启动数据库

[root@redhat ~]# systemctl start mariadb.service 

配置LAMP时使用到的数据库需要初始化数据库

[root@redhat ~]# 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): 
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] Y
New password: 
Re-enter new 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] Y
 ... 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] n
 ... skipping.

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] n
 ... skipping.

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... 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!

创建数据库

[root@redhat ~]# mysql -uroot -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 13
Server version: 10.3.11-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database luntan;
Query OK, 1 row affected (0.000 sec)

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| luntan             |
| mysql              |
| performance_schema |
+--------------------+
4 rows in set (0.001 sec)

重启数据库和Apache服务

[root@redhat ~]# systemctl restart mariadb.service httpd

上传论坛包到 /var/www/html 目录当中(需要论坛包可以留言发送)

[root@redhat ~]# cd /var/www/html/
[root@redhat html]# ll
total 0
[root@redhat html]# rz

[root@redhat html]# ll
total 11600
-rw-r--r--. 1 root root 11875579 Oct 25  2021 Discuz_X3.4_SC_UTF8_0101.zip

解压论坛源码包到当前目录中

[root@redhat html]# unzip Discuz_X3.4_SC_UTF8_0101.zip 

进入论坛包的upload目录中修改权限:

[root@redhat html]# cd dir_SC_UTF8/
[root@redhat dir_SC_UTF8]# ll
total 4
drwxr-xr-x.  2 root root  102 Dec 29  2017 readme
drwxr-xr-x. 13 root root 4096 Dec 29  2017 upload
drwxr-xr-x.  4 root root   94 Dec 29  2017 utility
[root@redhat dir_SC_UTF8]# cd upload/
[root@redhat upload]# chmod 777 config/ data/ uc_* -R

通过页面进行访问并安装
在浏览器输入:虚拟机IP地址/upload

继续下一步即可安装完毕
在这里插入图片描述

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值