OneinStack一键PHPJAVAHHVM安装及VPS手动安装L…

OneinStack一键PHPJAVAHHVM安装及VPS手动安装L…,第1张

OneinStack一键PHP/JAVA/HHVM安装及VPS手动安装L…

继著名的LAMPStack(Linux+Apache+MySQL/Mariadb+PHP)网站环境之后,LNMPStack(Linux+NGINX+MySQL/Mariadb+PHP)在Linux平台上,尤其是在低配置的VPS上已经开始流行。

说起LNMP,大部分人应该都知道lnmp.org站长开发的LNMP一键安装包。这个脚本包括虚拟主机管理、FTP用户管理、Nginx、MySQL/MariaDB和PHP的升级、常用缓存组件的安装、重置MySQLroot密码、502自动重启等。它在中国有许多用户,并得到官方论坛的支持。

然而,lnmp的一键安装包并不是lnmp.org唯一的一个。本文将在Linux运维注意事项下分享PHP/JAVA/HHVM的一键安装工具。Linux运维笔记的LNMP、lamp、lnmpa的一键安装包已经更新多年。作者的博客里也有很多原创的Linux技术文章和VPS脚本工具,可以看作是的一个“纯”程。

OneinStack的一键LNMP安装包和lnmp.org站长开发的一键LNMP安装包最大的区别就是支持LNMT(Linux+Nginx+MySQL+Tomcat):Nginx处理静态,Tomcat(JDK)处理JAVA,lnmh(Linux+Nginx+MySQL+HHVM)。

OneinStack一键工具提供多个Tomcat版本(Tomcat-8、Tomcat-7)和多个JDK版本(JDK-1.8、JDK-1.7、JDK-1.6),支持CentOS6和7下的HHVM安装。如果您仍然无法成功配置Java或HHVM环境,OneinStack可以帮助您。

当然我喜欢手工制作的LNMP,所以这篇文章就和大家分享一篇四弦博客提交的VPS手工安装LNMP的超详细教程,供有折腾精神的朋友参考。

OneinStack一键PHP/JAVA/HHVM安装和LNMP超详细VPS手动安装

一、OneinStack一键安装PHP/JAVA/HHVM

1.OneinStack官网:

官方网站:http://oneinstack.com/

作者:https://blog.linuxeye.com/31.html

2.OneinStack的一键PHP/JAVA/HHVM安装代码如下:(阿里云用户可以选择OneinStack阿里云节点,这样会更快)

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

3.OneinStack一键安装包支持以下组合的免费安装:

  • (Linux+Nginx+MySQL+PHP)
  • lamp(Linux+Apache+MySQL+PHP)
  • MPa(Linux+nginx+MySQL+PHP+Apache):nginx处理静态,Apache(mod_php)处理动态PHP。
  • LNMT(Linux+nginx+MySQL+Tomcat):nginx处理静态,Tomcat(JDK)处理JAVA。
  • lnmh(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等升级。

    Nginx-1.9.5+Mariadb-10.1+PHP-7.0.0rc5Ubuntu14.04lts上的网站环境建设教程

    二。编译并安装Nginx-1.9.5

    1.以上是LNMP的一键安装方法,后面是在Ubuntu-14.04LTS系统上手动构建LNMP环境的教程。之所以选择手工搭建环境,只是为了逼(雾)积累手工搭建环境的经验,找点乐子。如果你对此感兴趣,又有足够的闲暇时间,不妨一试。

    2.首先去nginx官方下载nginx的源代码(注:由于本博客之所以安装nginx-1.9.5是为了支持HTTP/2协议,对于一些不需要SSL的网站,本段后会给出1.8.0的教程)。

    cd/usr/local/src

    wgethttp://nginx.org/download/nginx-1.9.5.tar.gz

    3.下载LibreSSL(注:本博客使用LibreSSL的目的是为了支持SSL中使用的ChaCha20-Poly1305流加密算法。对于使用AES-GCM的站点,也可以使用这个SSL库)。

    cd/usr/local/src

    wgethttp://FTP.OpenBSD.org/pub/OpenBSD/libressl/libressl-2.3.0.tar.gz

    塔尔xzflibressl-2.3.0.tar.gz

    4.现在,/usr/local/src的目录结构与此类似(结构用反斜杠和缩进表示):

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

    5.编制准备:

    apt-getinstalllibpcre3libpcre3-devzlib1gzlib1g-dev groupaddwww useraddwww-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并开始编译:

    make makeinstall

    9.添加环境变量:

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

    10.输入:nginx-vv,如果显示nginx的版本,说明安装成功。

    1.如果不想安装nginx-1.9.5,可以参加这个方法安装nginx-1.8.0。 *** 作步骤同上,代码如下:

    cd/usr/local/src wgethttp://nginx.org/download/nginx-1.8.0.tar.gz cd/usr/local/src wgethttp://www.openssl.org/source/openssl-1.0.2d.tar.gz tarzxvfopenssl-1.0.2d.tar.gz cdopenssl-1.0.2d ./config make ldconfig apt-getinstalllibpcre3libpcre3-devzlib1gzlib1g-dev groupaddwww useraddwww-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.2d make makeinstall vim/etc/environment #vim *** 作请自行Google #在PATH变量的最后加入 :/usr/local/nginx/sbin #完成后类似于 PATH="/.../:/.../:......:/usr/local/nginx/sbin" #保存退出 source/etc/environment nginx-v

    三。apt-get快速安装MariaDB-10.1

    1.添加MariaDB官方apt来源:

    sudoapt-getinstallsoftware-properties-common sudoapt-keyadv--recv-keys--keyserverhkp://keyserver.ubuntu.com:800xcbcb082a1bb943db sudoadd-apt-repository'debhttp://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:

    apt-get安装mariadb-clientmariadb-server

    3.安装时,您将被要求输入根密码和重复密码。遵循要求。如果需要修改root密码,请使用:

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

    四。编译并安装PHP-7.0.0RC5

    1.下载PHP-7.0.0RC5源码包:

    cd/usr/local/src wgethttps://downloads.php.net/~ab/php-7.0.0RC5.tar.gz tarxzfphp-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-debug make#时间可能较长,我的vps.toVPS花费大约十五分钟 makeinstall

    4.添加环境变量:

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

    5.Test:php-vV.输出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/nginx chmod+x/etc/init.d/nginx servicenginxstart

    4.如果Nginx服务器正在启动,这意味着成功。最后,执行以下代码启动:

    update-RC.d–fnginx默认值

    5.修改MariaDB配置文件并设置MariaDB字符集:

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

    6.修改PHP配置文件并复制默认的php.ini文件:

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

    7.关闭显示错误:

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

    8.修改php-fpm配置:

    cd/usr/local/php/etc cpphp-fpm.conf.defaultphp-fpm.conf#如果没有则建立该文件 cdphp-fpm.d cpwww.conf.defaultwww.conf vimwww.conf #修改如下项目: user=www group=www listen=/dev/shm/php-cgi.sock listen.owner=www listen.group=www listen.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-fpm

    update-rc.d-fphp-fpm默认值

    10.启动php:

    服务php-fpm启动

    六。建立虚拟主机

    1.因为建立虚拟主机很麻烦,这里我们借用了oneinstack.com的虚拟主机脚本。使用以下命令来使用oneinstack程序包的虚拟主机脚本:

    wgethttp://mirrors.linuxeye.com/oneinstack.tar.gz tarxzfoneinstack.tar.gz cdoneinstack ./vhost.sh

    2.按照提示建立虚拟主机。

    3.将域名解析为VPS,输入对应的虚拟主机目录,编辑下面的PHP文件,或者上传一个PHP探针,就可以看到LNMP成功了:

    七。LNMP的VPS手动安装概要

    1.其实VPS手动安装LNMP还是挺麻烦的。当然,它的可定制性也很高。对于不想用LNMP一键安装包的朋友,可以手动编译最新版本的Nginx、MysqL、PHP等。,并且可以先体验新版本的性能提升。

    2.OneinStack的一键PHP/JAVA/HHVM安装包的作者也有很多实用的工具。比如LinuxVPS主机挂载硬盘的方法就比较复杂。下面是自动搜索硬盘并挂载它的代码:

    wgethttp://mirrors.linuxeye.com/scripts/auto_fdisk.sh chmod+x./auto_fdisk.sh ./auto_fdisk.sh

    3.当你看到下图,说明你已经成功自动挂载了。这种方法已经在阿里云VPS上进行了测试,其他VPS主机也可以使用。

    欢迎分享,转载请注明来源:内存溢出

    原文地址: https://outofmemory.cn/zz/765300.html

    (0)
    打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
    上一篇 2022-05-02
    下一篇 2022-05-02

    发表评论

    登录后才能评论

    评论列表(0条)

    保存