- A+
所属分类:网站技术
对于想建站或者是买了服务器想鼓捣一下,可能对于运维,服务器环境搭建又没什么了解,完全可以通过整合脚本来搭建,仅需要懂一些基本的命令。这篇文章基本属于搬运,做下记录吧,github。
0.介绍
1.包含以下组合
- lnmp(Linux + Nginx+ MySQL+ PHP)
- lamp(Linux + Apache+ MySQL+ PHP)
- lnmpa(Linux + Nginx+ MySQL+ PHP+ Apache):Nginx处理静态,Apache(mod_php)处理动态PHP
- lnmt(Linux + Nginx+ MySQL+ Tomcat):Nginx处理静态,Tomcat(JDK)处理JAVA
- lnmh(Linux + Nginx+ MySQL+ HHVM)
2.支持系统版本
- CentOS 6~7(包括redhat)
- Debian 6~9
- Ubuntu 12~16
- Aliyun Linux 15.1
1.下载
阿里云内网线路(非VPC专有网络,10M/S以上),包含源码
http://aliyun-oss.linuxeye.com/oneinstack-full.tar.gz
国内线路(5M/S),包含源码
http://mirrors.linuxeye.com/oneinstack-full-beta.tar.gz #包含COS备份
http://mirrors.linuxeye.com/oneinstack-full.tar.gz
国外线路(LINODE FREMONT,10M/S),包含源码
http://mirrors.linuxeye.com/oneinstack-full.tar.gz
SOURCEFORGE,包含源码
http://downloads.sourceforge.net/project/oneinstack/oneinstack-full.tar.gz
欧洲线路,包含源码
https://mirrors.dtops.cc/linuxeye/oneinstack-full.tar.gz
不包含源码,建议仅国外主机下载
http://mirrors.linuxeye.com/oneinstack.tar.gz
2.安装
1.注意
如果有单独数据盘,建议您先挂载数据盘,建议将网站内容、数据库放在数据盘中。如何挂载数据盘,请参考(支持阿里云、腾讯云):《如何利用脚本自动化挂载数据盘?》,下面安装自己选择一条
- #根据系统安装wget工具
- yum -y install wget screen curl python #for CentOS/Redhat
- # apt-get -y install wget screen curl python #for Debian/Ubuntu
- #下载源码根据自己的选择使用
- wget http://aliyun-oss.linuxeye.com/oneinstack-full.tar.gz #阿里云经典网络下载
- wget http://mirrors.linuxeye.com/oneinstack-full.tar.gz #包含源码,国内外均可下载
- wget http://mirrors.linuxeye.com/oneinstack.tar.gz #不包含源码,建议仅国外主机下载
- #解压安装
- tar xzf oneinstack-full.tar.gz
- cd oneinstack #如果需要修改目录(安装、数据存储、Nginx日志),请修改options.conf文件
- screen -S oneinstack #如果网路出现中断,可以执行命令`screen -R oneinstack`重新连接安装窗口
- ./install.sh #注:请勿sh install.sh或者bash install.sh这样执行
2.如何添加附加组件?
- ./addons.sh
3.如何添加虚拟主机?
- ./vhost.sh
4.如何删除虚拟主机?
- ./vhost.sh del
5.如何管理FTP账号?
- ./pureftpd_vhost.sh
6.如何备份?
- ./backup_setup.sh <span class="pl-c"># Set backup options </span>
- ./backup.sh # Start backup, You can add cron jobs
- # crontab -l # Examples
- 0 1 * * * cd ~/oneinstack;./backup.sh > /dev/null 2>&1 &
7.如何管理服务?
Nginx/Tengine/OpenResty:
- service nginx {start<span class="pl-k">|</span>stop<span class="pl-k">|</span>status<span class="pl-k">|</span>restart<span class="pl-k">|</span>reload<span class="pl-k">|</span>configtest}
MySQL/MariaDB/Percona:
- service mysqld {start<span class="pl-k">|</span>stop<span class="pl-k">|</span>restart<span class="pl-k">|</span>reload<span class="pl-k">|</span>status}
PHP:
- service php-fpm {start<span class="pl-k">|</span>stop<span class="pl-k">|</span>restart<span class="pl-k">|</span>reload<span class="pl-k">|</span>status}
HHVM:
- service supervisord {start|stop|status|restart|reload}
注:hhvm进程交给supervisord管理,了解更多请访问《Supervisor管理hhvm进程》
Apache:
- service httpd {start|restart|stop}
Tomcat:
- service tomcat {start|stop|status|restart}
Pure-Ftpd:
- service pureftpd {start|stop|restart|status}
Redis:
- service redis-server {start|stop|status|restart|reload}
Memcached:
- service memcached {start|stop|status|restart|reload}
8.如何更新版本?
- ./upgrade.sh
9.如何卸载?
- ./uninstall.sh
3.问题/其他
- 出于安全考虑,MySQL默认本地连接,如需远程连接(一般是为了使用navicat这样的第三方工具),需要:1.iptables开启远程端口如3306,2.数据库授权。
- 如何部署java应用:上传war包或者文件到对应网站根目录如/data/wwwroot/default
- 设置网站根目录权限:
- chown -R www.www /data/wwwroot/
- find /data/wwwroot/ -type d -exec chmod 755 {} \;
- find /data/wwwroot/ -type f -exec chmod 644 {} \;