2022
我们一起努力

lnmp安装教程(lnmp环境搭建完全手册)

目录:

  • 1、如何在cent OS系统安装LNMP一键安装包
  • 2、linux下怎么安装lnmp一键安装包
  • 3、lnmp 怎么装apache
  • 4、CentOS 7 用户怎样安装 LNMP

如何在cent OS系统安装LNMP一键安装包

配备Windows操作系统而且能够上网的PC
安装光盘dmg镜像文件
23G的可用空间
你的勇气和耐性第一步:
缩小现有分区卷
右键点击我的电脑(计算机)——管理——弹出来的窗口左边的磁盘管理,这里你可以看见你的硬盘分区状况。
我的D盘有很多的剩余空间,所以我拿它来开刀,之前说过,我们共需要20+6.3=26.3GB的空间,因此,我要先把D盘缩小26.3G,在D盘上点击右键——压缩卷然后在弹出来的框输入26906(1024MB/GB×26.3GB),然后按确定即可。 虽然这个指南的操作不会删除你硬盘上的数据,不过,在处理与分区有关的步骤是整个指南里面最危险的一步,稍有不慎,你的数据将在弹指间烟消云散,请一定不要忽略任何警告框里面的提示。
右键点击未分配空间——新建简单卷,点击下一步后输入6426(1024MB/GB×6.3GB),下一步将此空间分配到E,不要格式化(记住了!)。完成之后Windows会弹出框告诉你需要格式化E才能访问,先谢谢她的好意,不过选择取消,不格式化。用同样的办法把剩下的20G也新建一个卷。
这个卷随便你格不格式化。
第二步:加载DVD到硬盘并修改。把下载好的懒人版镜像通过硬盘助手写入后面的6.3G未格式化的那个分区。2.此时如果程序出现没响应也不必担心,耐心等待拷贝完成。确保完成后出现Change Partition type to AF: success字样如下(必须),如果是Failed的话,把分区格式化,再删除重新来一遍,或者手动使用Acronis Disk Director Suite或Paragon PM把分区格式标志设为AF,AF是16进制里面175的意思,HFS分区应有AF的标记。 第三步:使用变色龙Chameleon启动雪豹安装盘
1.开机的时候选择刚从变色龙Chameleon启动项启动会看到类似下面的界面
2.对Mac兼容比较好主板,一般都可以直接进入安装界面
3.现在需要进行抹盘操作就是那个20GB的分区(一定看清楚摸错了就哭去吧)
4.将需要抹盘的分区改为max os扩展(日志式)
5.关闭磁盘工具进行安装 6.安装成功后会有提示,如果安装失败,本人表示无能为力,别问我了。不过安装失败并不是“真正的失败”,你就当作安装成功,继续操作,应该也可以进系统。
7.重启后你会发现进不了win,因为此时活动分区被Mac系统盘抢去了。这时进入win7 pe把C盘标记为活动就行了
8.进入win你就可以看到Mac系统盘,然后把安装盘的Extra文件夹复制到系统盘,重启,通过变色龙引导系统盘,9.接着是几部简单的下一步步骤真的就不给图了,真的很简单。
第四步完善阶段.设置安全性与隐私(如果不设置此项,会不能正常安装pkg和mpkg包。)当然这是最顺利安装,楼主可能会面临进入MAC过后分辨率不可调没有声音不能上网等一系列问题,到时候楼主需要开新帖求助了,安装教程到此结束!

linux下怎么安装lnmp一键安装包

是rpm包吗?如果是,尝试以下办法: 进入lnmp的解压路径 yum localinstall lnmp -y 如果你是以普通用户登录系统 sudo yum localinstall lnmp -y 密码是登录系统的一般用户密码 如果sudo不能用 su -c 'yum localinstall lnmp -y' 密码是root的密码。

lnmp 怎么装apache

lanmp一键包软件版本升级脚本及说明

虽然个人觉得,应用环境一般安装好就不用升级,除非出现问题或程序出漏洞等,就有必要升级了

但为满足想升级的朋友,这里也会给出一些升级脚本,可以让自行选择是否升级了

版本升级

nginx的升级,当前最新稳定版本是1.0.14

wget

sh nginx_up.sh

默认升级是1.0.14,如要指定版本,执行脚本后台加上版本号就可以,如

sh nginx_up.sh 1.0.12

就是只升级到1.0.12版本了

lanmp_v2.4/wdcp_v2.4开始,支持lamp,lnmp,lnamp可自由切换

如果之前的版本,也想切换,升级一下就可以

wget

tar zxvf lanmp_v2.4.tar.gz

chmod 755 lanmp_up.sh

./lanmp_up.sh

顺利的话,执行完就可以了升级后lamp,lnmp,lnamp可自由切换

如不行或有错误,把错误信息,贴到论坛上来

2.4以下的,环境切换

wget

tar zxvf lanmp_v2.4.tar.gz

chmod 755 tolamp.sh tolnmp.sh tolnamp.sh

./tolamp.sh 切换至lamp环境

./tolnmp.sh 切换至lnmp环境

./tolnamp.sh 切换至lnamp环境

根据实际选择操作

更多的升级脚本,后续会放出

CentOS 7 用户怎样安装 LNMP

1 先说一下

本文使用的主机名称: server1.example.com 和IP地址: 192.168.1.105。这些可能与你的计算机有所不同,注意进行修改。

2 使用外部仓库

Nginx不是从官方CentOS库安装,我们从 nginx 项目安装库安装,修改源:

vi /etc/yum.repos.d/nginx.repo

修改为:

[nginx]

name=nginx repo

baseurl=

gpgcheck=0

enabled=1

3 安装 MySQL

我们先安装MariaDB。一个免费的MySQL 分支。运行此命令:

yum install mariadb mariadb-server net-tools

然后我们创建MySQL系统启动链接(所以MySQL的自动启动时,系统启动)启动MySQL服务器:

systemctl enable mariadb.service

systemctl start mariadb.service

现在检查网络启用。运行

netstat -tap | grep mysql

它应该显示出这样的内容:

[root@example ~]# netstat -tap | grep mysql

tcp 0 0 0.0.0.0:mysql 0.0.0.0:* LISTEN 10623/mysqld

运行

mysql_secure_installation

为用户设置根口令(否则,任何人都可以访问你的MySQL数据库!):

[root@example ~]# mysql_secure_installation

/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found

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] – 回车

New password: – 输入ROOT密码

Re-enter new password: – 再输入一次ROOT密码

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] – 回车

… 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] – 回车

… 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] – 回车

- 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] – 回车

… 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@example ~]#

[root@server1 ~]# mysql_secure_installation

4 安装 Nginx

Nginx可以作为一个包从nginx.org安装,运行:

yum install nginx

然后我们创建的系统启动nginx的链接和启动它:

systemctl enable nginx.service

systemctl start nginx.service

有时,你会得到一个错误,如80端口已在使用中,错误消息会是这样的

[root@server1 ~]# service nginx start

Starting nginx: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

nginx: [emerg] still could not bind()

[FAILED]

[root@server1 ~]#

这就意味着有时在运行Apache服务。停止服务,进一步启动服务nginx如下

systemctl stop httpd.service

yum remove httpd

systemctl disable httpd.service

systemctl enable nginx.service

systemctl start nginx.service

开放的HTTP和HTTPS防火墙中的端口

firewall-cmd –permanent –zone=public –add-service=http

firewall-cmd –permanent –zone=public –add-service=https

firewall-cmd –reload

输出的shell结果将看起来像这样:

[root@example ~]# firewall-cmd –permanent –zone=public –add-service=http

success

[root@example ~]# firewall-cmd –permanent –zone=public –add-service=https

success

[root@example ~]# firewall-cmd –reload

success

[root@example ~]#

在你的Web服务器的IP地址或主机名称输入到浏览器(如HTTP:/ /192.168.1.105),你应该看到nginx的欢迎页面。

5 安装 PHP5

我们可以通过PHP-FPM使nginx的PHP5工作(PHP-FPM(FastCGI进程管理器)是一种替代PHP FastCGI执行一些额外的功能,支持任何规模大小,尤其是繁忙的站点很有用)。我们可以安装php-fpmtogether用PHP-CLI和一些PHP5的模块,如PHP,MySQL,你需要的,如果你想使用MySQL的PHP命令如下:

yum install php-fpm php-cli php-mysql php-gd php-ldap php-odbc php-pdo php-pecl-memcache php-pear php-mbstring php-xml php-xmlrpc php-mbstring php-snmp php-soap

APC是一个自由和开放的PHP操作码来缓存和优化PHP的中间代码。它类似于其他PHP操作码cachers,如eAccelerator和XCache。强烈建议有这些安装,以加快您的PHP页面。

我会从PHP PECL库中安装的APC。 PECL要求CentOS开发工具beinstalled编译APC包。

yum install php-devel

yum groupinstall ‘Development Tools’

安装 APC

pecl install apc

[root@example ~]# pecl install apc

downloading APC-3.1.13.tgz …

Starting to download APC-3.1.13.tgz (171,591 bytes)

……………..done: 171,591 bytes

55 source files, building

running: phpize

Configuring for:

PHP Api Version: 20100412

Zend Module Api No: 20100525

Zend Extension Api No: 220100525

Enable internal debugging in APC [no] : – 回车

Enable per request file info about files used from the APC cache [no] : – 回车

Enable spin locks (EXPERIMENTAL) [no] : – 回车

Enable memory protection (EXPERIMENTAL) [no] : – 回车

Enable pthread mutexes (default) [no] : –回车

Enable pthread read/write locks (EXPERIMENTAL) [yes] : – 回车

building in /var/tmp/pear-build-rootVrjsuq/APC-3.1.13

……

然后打开 /etc/php.ini 并设置 cgi.fix_pathinfo=0:

vi /etc/php.ini

[...]

; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's

; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok

; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting

; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting

; of zero causes PHP to behave as before. Default is 1. You should fix your scripts

; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.

;

cgi.fix_pathinfo=0

[...]

并添加行:

[...]

extension=apc.so

在 /etc/php.ini 文件后面。

除此之外,为了避免这样的时区的错误:

[21-July-2014 10:07:08] PHP Warning: phpinfo(): It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘Europe/Berlin’ for ‘CEST/2.0/DST’ instead in /usr/share/nginx/html/info.php on line 2

… in /var/log/php-fpm/www-error.log 当你在浏览器中调用一个PHP脚本,你应该设置 date.timezone in /etc/php.ini:

[...]

[Date]

; Defines the default timezone used by the date functions

;

date.timezone = "Europe/Berlin"

[...]

您可以通过运行正确的时区支持您的系统:

cat /etc/sysconfig/clock

[root@server1 nginx]# cat /etc/sysconfig/clock

ZONE=”Europe/Berlin”

[root@server1 nginx]#

接下来,创建系统启动链接的PHP-FPM并启动它:

systemctl enable php-fpm.service

systemctl start php-fpm.service

PHP-FPM是一个守护进程(使用init脚本/etc/init.d/php-fpm) 运行在端口9000的FastCGI服务器。

赞(0)
文章名称:《lnmp安装教程(lnmp环境搭建完全手册)》
文章链接:https://www.fzvps.com/152181.html
本站文章来源于互联网,如有侵权,请联系管理删除,本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。
图片版权归属各自创作者所有,图片水印出于防止被无耻之徒盗取劳动成果的目的。

评论 抢沙发

评论前必须登录!