OneinStack如何一键安装LNMP

免费建站   2024年02月09日 4:36  

本篇内容主要讲解“OneinStack如何一键安装LNMP”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“OneinStack如何一键安装LNMP”吧!

oneinstack一键php/java/hhvm安装和超详细的vps手动安装lnmp

一、oneinstack一键php/java/hhvm安装

1、oneinstack官网:

官方网站:

2、oneinstack一键php/java/hhvm安装代码如下:(阿里云用户可以选择oneinstack阿里云节点,这样速度会更快一些)

yum-yinstallwgetscreencurlpython#forcentos/redhat#apt-get-yinstallwgetscreencurlpython#fordebian/ubuntuwgethttp://aliyun-oss.linuxeye.com/-full.tar.gz#阿里云用户下载wgethttp://mirrors.linuxeye.com/-full.tar.gz#包含源码,国内外均可下载wgethttp://mirrors.linuxeye.com/.tar.gz#不包含源码,建议仅国外主机下载tarxzfoneinstack-full.tar.gzcdoneinstack#如果需要修改目录(安装、数据存储、nginx日志),请修改options.conf文件screen-soneinstack#如果网路出现中断,可以执行命令`screen-roneinstack`重新连接安装窗口./install.sh#注:请勿shinstall.sh或者bashinstall.sh这样执行

3、oneinstack一键安装包支持以下组合自由安装:

(linux+nginx+mysql+php)lamp(linux+apache+mysql+php)lnmpa(linux+nginx+mysql+php+apache):nginx处理静态,apache(mod_php)处理动态phplnmt(linux+nginx+mysql+tomcat):nginx处理静态,tomcat(jdk)处理javalnmh(linux+nginx+mysql+hhvm)

4、你安装时可以自己选择。(点击放大)

5、然后你可以根据你自己的需要来安装php缓存加速器,提供zendopcache、xcache、apcu、eaccelerator。(点击放大)

6、还有php加解密工具ioncube、zendguardloader ,和memcached、redis等。(点击放大)

7、oneinstack一键安装支持升级:./upgrade.sh,提供了nginx、tengine、apache、php、mysql、redis等升级。(点击放大)

ubuntu14.04lts上的nginx-1.9.5 + mariadb-10.1 + php-7.0.0rc5网站环境搭建教程

二、编译安装nginx-1.9.5

1、上面是lnmp一键安装方法,接下来就是关于在ubuntu-14.04 lts系统上手动搭建lnmp环境的教程。之所以选择手动搭建环境,无非是为了装逼(大雾)从手动搭建中积累搭建环境的经验,并且享受到一定的乐趣。如果您对这方面感兴趣,又有足够的闲暇时间,不妨一试。

2、首先,到nginx官方下载nginx源码(注:由于本博安装nginx-1.9.5的原因是为了支持http/2协议,所以对于部分不需要ssl的网站,会在本段后给出一个1.8.0的教程)。

cd/usr/local/srcwgethttps://nginx.org/download/nginx-1.9.5.tar.gz

3、 下载libressl(注:本博使用libressl的目的是支持ssl中使用的chacha20-poly1305流式加密算法,对于使用aes-gcm的站点,也可以使用该ssl库)。

cd/usr/local/srcwgethttps://ftp.openbsd.org/pub/openbsd/libressl/libressl-2.3.0.tar.gztarxzflibressl-2.3.0.tar.gz

4、现在,/usr/local/src的目录结构类似这样(以反斜线与缩进显示结构):

usr\local\src\libressl-2.3.0nginx-1.9.5

5、 编译准备工作:

apt-getinstalllibpcre3libpcre3-devzlib1gzlib1g-devgroupaddwwwuseraddwww-gwww

6、开始编译nginx:

./configure\--user=www\--group=www\--prefix=/usr/local/nginx\--with-http_stub_status_module\--with-http_ssl_module\--with-http_gzip_static_module\--with-ipv6\--with-http_v2_module\--with-openssl=../libressl-2.3.0

7、我所使用的编译参数说明如下:

--user=www\#指定nginx运行用户--group=www\#指定nginx运行用户组--prefix=/usr/local/nginx\#指定nginx安装路径,不用修改--with-http_stub_status_module\#开启状态监控模块--with-http_ssl_module\#开启ssl--with-http_gzip_static_module\#开启gzip--with-ipv6\#开启ipv6,无v6可去掉--with-http_v2_module\#开启http/2--with-openssl=../libressl-2.3.0#指定openssl路径

8、建立makefile完成,开始编译:

makemakeinstall

9、加入环境变量:

vim/etc/environment#vim操作请自行google#在path变量的最后加入:/usr/local/nginx/sbin#完成后类似于path="/.../:/.../:......:/usr/local/nginx/sbin"#保存退出source/etc/environment

10、输入:nginx -v ,显示 nginx 的版本就说明安装成功了。

11、 如果不想安装nginx-1.9.5的话,可以参加此方法安装nginx-1.8.0,操作步骤和上面一样的,代码如下:

cd/usr/local/srcwgethttps://nginx.org/download/nginx-1.8.0.tar.gzcd/usr/local/srcwgethttps://www.openssl.org/source/openssl-1.0.2d.tar.gztarzxvfopenssl-1.0.2d.tar.gzcdopenssl-1.0.2d./configmakeldconfigapt-getinstalllibpcre3libpcre3-devzlib1gzlib1g-devgroupaddwwwuseraddwww-gwww./configure\--user=www\--group=www\--prefix=/usr/local/nginx\--with-http_stub_status_module\--with-http_ssl_module\--with-http_gzip_static_module\--with-ipv6\--with-http_v2_module\--with-openssl=/usr/local/src/openssl-1.0.2dmakemakeinstallvim/etc/environment#vim操作请自行google#在path变量的最后加入:/usr/local/nginx/sbin#完成后类似于path="/.../:/.../:......:/usr/local/nginx/sbin"#保存退出source/etc/environmentnginx-v

三、apt-get快速安装mariadb-10.1

1、添加mariadb官方apt源:

sudoapt-getinstallsoftware-properties-commonsudoapt-keyadv--recv-keys--keyserverhkp://keyserver.ubuntu.com:800xcbcb082a1bb943dbsudoadd-apt-repository'debhttps://mariadb.nethub.com.hk//repo/10.1/ubuntutrustymain'#我的vps是香港softlayer数据中心vps.to的vps,因此,本处添加了hk的apt源,您可以在这里找到更#多的源:https://downloads.mariadb.org/mariadb/repositories

2、apt-get安装mariadb:

pt-getinstallmariadb-clientmariadb-server

3、安装时会要求输入root密码以及重复密码,按照要求进行。如果需要修改root密码,使用:

/usr/bin/mysqladmin-uroot-p旧密码新密码

四、编译安装php-7.0.0rc5

1、下载php-7.0.0rc5源码包:

cd/usr/local/srcwgethttps://downloads.php.net/~ab/php-7.0.0rc5.tar.gztarxzfphp-7.0.0rc5.tar.gz

2、安装php依赖包:

sudoapt-getinstalllibxml2-devlibpcre3-devlibbz2-devlibcurl4-openssl-devlibjpeg-devlibpng12-devlibxpm-devlibfreetype6-devlibmysqlclient-devlibt1-devlibgd2-xpm-devlibgmp-devlibsasl2-devlibmhash-devunixodbc-devfreetds-devlibpspell-devlibsnmp-devlibtidy-devlibxslt1-devlibmcrypt-dev

3、编译php:

cd/usr/local/src/php-7.0.0rc5./configure--prefix=/usr/local/php\--with-config-file-path=/usr/local/php/etc\--with-fpm-user=www--with-fpm-group=www\--enable-fpm\--disable-fileinfo\--enable-mysqlnd\--with-mysqli=mysqlnd\--with-pdo-mysql=mysqlnd\--with-iconv-dir=/usr/local\--with-freetype-dir\--with-jpeg-dir\--with-png-dir\--with-zlib\--with-libxml-dir=/usr\--enable-xml\--disable-rpath\--enable-bcmath\--enable-shmop\--enable-exif\--enable-sysvsem\--enable-inline-optimization\--with-curl\--enable-mbregex\--enable-inline-optimization\--enable-mbstring\--with-mcrypt\--with-gd\--enable-gd-native-ttf\--with-openssl\--with-mhash\--enable-pcntl\--enable-sockets\--with-xmlrpc\--enable-ftp\--with-gettext\--enable-zip\--enable-soap\--disable-debugmake#时间可能较长,我的vps.tovps花费大约十五分钟makeinstall

4、添加环境变量:

vim/etc/environment#在path变量的最后加入::/usr/local/php/bin#保存退出source/etc/environment

5、测试:php -v,输出php版本就表示安装成功了。

五、修改nginx、mariadb、php配置文件

1、修改nginx配置文件,建立虚拟主机配置文件夹:

mkdir/usr/local/nginx/conf/vhost

2、编辑nginx.conf,引入所有虚拟主机配置:

vim/usr/local/nginx/conf/nginx.conf#在最后的}前一行加入includevhost/*.conf;#文件头部userwww;work_process1;#根据cpu核数设定#保存退出

3、添加nginx服务,并测试nginx:

wgethttps://raw.github.com/jasongiedymin/nginx-init-ubuntu/master/nginx-o/etc/init.d/nginxchmod+x/etc/init.d/nginxservicenginxstart

4、如果出现nginx服务器正在启动就表示成功了,最后执行以下代码开机启动:

update-rc.d–fnginxdefaults

5、修改mariadb配置文件,设置mariadb字符集:

cd/etc/my.cnf.dvimserver.cnf#在[mysqld]段下加入character-set-server=utf8#在[server]段上方输入[client]default-character-set=utf8#保存退出servicemysqlrestart

6、修改php配置文件,复制默认php.ini文件:

cd/usr/local/src/php-7.0.0rc5cpphp.ini-production/usr/local/php/etc/php.ini

7、关闭display_errors:

vim/usr/local/php/etc/php.ini#定位到display_errors,设置:display_errors=off#保存退出

8、修改php-fpm配置:

cd/usr/local/php/etccpphp-fpm.conf.defaultphp-fpm.conf#如果没有则建立该文件cdphp-fpm.dcpwww.conf.defaultwww.confvimwww.conf#修改如下项目:user=wwwgroup=wwwlisten=/dev/shm/php-cgi.socklisten.owner=wwwlisten.group=wwwlisten.mode=0660#保存退出

9、建立php服务:

cp/usr/local/src/php-7.0.0rc5/sapi/fpm/init.d.php-fpm/etc/init.d/php-fpmchmod+x/etc/init.d/php-fpmupdate-rc.d-fphp-fpmdefaults

10、启动php:

servicephp-fpmstart

六、建立虚拟主机

1、由于建立虚拟主机是个比较麻烦的事儿,此处还是借用了oneinstack.com的虚拟主机脚本,使用如下命令即可使用oneinstack包的虚拟主机脚本:

wgethttps://mirrors.linuxeye.com/oneinstack.tar.gztarxzfoneinstack.tar.gzcdoneinstack./vhost.sh

2、按提示进行即可建立虚拟主机。(点击放大)

3、将域名解析到vps上,进入对应虚拟主机目录,编辑如下php文件,或者上传一个php探针,然后就能查看到lnmp成功了:

七、vps手动安装lnmp小结

1、其实,vps手动安装lnmp还是挺麻烦的,当然它的可定制性也是非常高,对于不想使用lnmp一键安装包的朋友来说,自己手动可以编译最新版本的nginx、mysql、php等,能够最先体验到新版的性能提升。

2、oneinstack一键php/java/hhvm安装包的作者还有不少的实用工具,这里有一个自动搜索硬盘并挂载的代码:

wgethttps://mirrors.linuxeye.com/scripts/auto_fdisk.shchmod+x./auto_fdisk.sh./auto_fdisk.sh

3、看到如下图就表示已经自动挂载成功了,该方法在阿里云vps上测试通过,其它的vps主机都是可以用的。

到此,相信大家对“OneinStack如何一键安装LNMP”有了更深的了解,不妨来实际操作一番吧!这里是网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

域名注册
购买VPS主机

您或许对下面这些文章有兴趣:                    本月吐槽辛苦排行榜

看贴要回贴有N种理由!看帖不回贴的后果你懂得的!


评论内容 (*必填):
(Ctrl + Enter提交)   

部落快速搜索栏

各类专题梳理

网站导航栏

X
返回顶部