安装步骤
注意
1. apt或者yum源必须配置好,参考:《CentOS、Ubuntu、Debian依赖源配置》
2. 如果有单独数据盘,建议您先挂载数据盘,建议将网站内容、数据库放在数据盘中。如何挂载数据盘,请参考(支持阿里云、腾讯云):《如何利用脚本自动化挂载数据盘?》
3. 云主机请注意安全组,参考:《云主机安全组端口开放教程》
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 11px; margin: 10px 0px; overflow: auto; display: block; color: rgb(33, 37, 41); padding: 11px 16px; border-radius: 4px; background-color: rgb(248, 248, 248); overflow-wrap: break-word; line-height: 1.7; word-break: break-all; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 350; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">yum -y install wget screen #for CentOS/Redhat
apt-get -y install wget screen #for Debian/Ubuntu
wget http://mirrors.linuxeye.com/oneinstack-full.tar.gz #包含源码,国内外均可下载
tar xzf oneinstack-full.tar.gz
cd oneinstack #如果需要修改目录(安装、数据存储、Nginx日志),请修改options.conf文件
screen -S oneinstack #如果网路出现中断,可以执行命令screen -R oneinstack
重新连接安装窗口
./install.sh</pre>
如何添加附加组件?
注意
如果之前没有安装组件,后续补充安装,统一入口为./install.sh
,addons.sh脚本不在提供,如之前没有安装php redis扩展,补充安装命令:./install.sh --php_extensions redis
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 11px; margin: 10px 0px; overflow: auto; display: block; color: rgb(33, 37, 41); padding: 11px 16px; border-radius: 4px; background-color: rgb(248, 248, 248); overflow-wrap: break-word; line-height: 1.7; word-break: break-all; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 350; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">~/oneinstack/addons.sh</pre>
如何添加虚拟主机?
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 11px; margin: 10px 0px; overflow: auto; display: block; color: rgb(33, 37, 41); padding: 11px 16px; border-radius: 4px; background-color: rgb(248, 248, 248); overflow-wrap: break-word; line-height: 1.7; word-break: break-all; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 350; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">~/oneinstack/vhost.sh</pre>
如何删除虚拟主机?
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 11px; margin: 10px 0px; overflow: auto; display: block; color: rgb(33, 37, 41); padding: 11px 16px; border-radius: 4px; background-color: rgb(248, 248, 248); overflow-wrap: break-word; line-height: 1.7; word-break: break-all; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 350; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">~/oneinstack/upgrade.sh --oneinstack #升级脚本工具,不影响正在运行环境
~/oneinstack/vhost.sh --del</pre>
如何管理FTP账号?
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 11px; margin: 10px 0px; overflow: auto; display: block; color: rgb(33, 37, 41); padding: 11px 16px; border-radius: 4px; background-color: rgb(248, 248, 248); overflow-wrap: break-word; line-height: 1.7; word-break: break-all; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 350; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">~/oneinstack/pureftpd_vhost.sh</pre>
如何备份?
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 11px; margin: 10px 0px; overflow: auto; display: block; color: rgb(33, 37, 41); padding: 11px 16px; border-radius: 4px; background-color: rgb(248, 248, 248); overflow-wrap: break-word; line-height: 1.7; word-break: break-all; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 350; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">~/oneinstack/backup_setup.sh # Set backup options </pre>
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 11px; margin: 10px 0px; overflow: auto; display: block; color: rgb(33, 37, 41); padding: 11px 16px; border-radius: 4px; background-color: rgb(248, 248, 248); overflow-wrap: break-word; line-height: 1.7; word-break: break-all; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 350; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"> ~/oneinstack/backup.sh # Start backup, You can add cron jobs
crontab -l # Examples
0 1 * * * ~/oneinstack/backup.sh > /dev/null 2>&1 &</pre>
如何管理服务?
注意
如果服务器包含systemd,则使用systemctl管理,且兼容service。
Nginx/Tengine/OpenResty:
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 11px; margin: 10px 0px; overflow: auto; display: block; color: rgb(33, 37, 41); padding: 11px 16px; border-radius: 4px; background-color: rgb(248, 248, 248); overflow-wrap: break-word; line-height: 1.7; word-break: break-all; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 350; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">service nginx {start|stop|status|restart|reload|configtest}</pre>
MySQL/MariaDB/Percona:
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 11px; margin: 10px 0px; overflow: auto; display: block; color: rgb(33, 37, 41); padding: 11px 16px; border-radius: 4px; background-color: rgb(248, 248, 248); overflow-wrap: break-word; line-height: 1.7; word-break: break-all; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 350; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">service mysqld {start|stop|restart|reload|status}</pre>
PostgreSQL:
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 11px; margin: 10px 0px; overflow: auto; display: block; color: rgb(33, 37, 41); padding: 11px 16px; border-radius: 4px; background-color: rgb(248, 248, 248); overflow-wrap: break-word; line-height: 1.7; word-break: break-all; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 350; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">service postgresql {start|stop|restart|status}</pre>
MongoDB:
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 11px; margin: 10px 0px; overflow: auto; display: block; color: rgb(33, 37, 41); padding: 11px 16px; border-radius: 4px; background-color: rgb(248, 248, 248); overflow-wrap: break-word; line-height: 1.7; word-break: break-all; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 350; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">service mongod {start|stop|status|restart|reload}</pre>
PHP:
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 11px; margin: 10px 0px; overflow: auto; display: block; color: rgb(33, 37, 41); padding: 11px 16px; border-radius: 4px; background-color: rgb(248, 248, 248); overflow-wrap: break-word; line-height: 1.7; word-break: break-all; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 350; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">service php-fpm {start|stop|restart|reload|status}</pre>
HHVM:
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 11px; margin: 10px 0px; overflow: auto; display: block; color: rgb(33, 37, 41); padding: 11px 16px; border-radius: 4px; background-color: rgb(248, 248, 248); overflow-wrap: break-word; line-height: 1.7; word-break: break-all; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 350; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">service supervisord {start|stop|status|restart|reload}</pre>
注:hhvm进程交给supervisord管理,了解更多请访问《Supervisor管理hhvm进程》
Apache:
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 11px; margin: 10px 0px; overflow: auto; display: block; color: rgb(33, 37, 41); padding: 11px 16px; border-radius: 4px; background-color: rgb(248, 248, 248); overflow-wrap: break-word; line-height: 1.7; word-break: break-all; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 350; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">service httpd {start|restart|stop}</pre>
Tomcat:
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 11px; margin: 10px 0px; overflow: auto; display: block; color: rgb(33, 37, 41); padding: 11px 16px; border-radius: 4px; background-color: rgb(248, 248, 248); overflow-wrap: break-word; line-height: 1.7; word-break: break-all; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 350; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">service tomcat {start|stop|status|restart}</pre>
Pure-Ftpd:
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 11px; margin: 10px 0px; overflow: auto; display: block; color: rgb(33, 37, 41); padding: 11px 16px; border-radius: 4px; background-color: rgb(248, 248, 248); overflow-wrap: break-word; line-height: 1.7; word-break: break-all; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 350; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">service pureftpd {start|stop|restart|status}</pre>
Redis:
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 11px; margin: 10px 0px; overflow: auto; display: block; color: rgb(33, 37, 41); padding: 11px 16px; border-radius: 4px; background-color: rgb(248, 248, 248); overflow-wrap: break-word; line-height: 1.7; word-break: break-all; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 350; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">service redis-server {start|stop|status|restart}</pre>
Memcached:
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 11px; margin: 10px 0px; overflow: auto; display: block; color: rgb(33, 37, 41); padding: 11px 16px; border-radius: 4px; background-color: rgb(248, 248, 248); overflow-wrap: break-word; line-height: 1.7; word-break: break-all; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 350; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">service memcached {start|stop|status|restart|reload}</pre>
如何更新版本?
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 11px; margin: 10px 0px; overflow: auto; display: block; color: rgb(33, 37, 41); padding: 11px 16px; border-radius: 4px; background-color: rgb(248, 248, 248); overflow-wrap: break-word; line-height: 1.7; word-break: break-all; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 350; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">~/oneinstack/upgrade.sh</pre>
如若上图无OneinStack选项,请执行下面:
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 11px; margin: 10px 0px; overflow: auto; display: block; color: rgb(33, 37, 41); padding: 11px 16px; border-radius: 4px; background-color: rgb(248, 248, 248); overflow-wrap: break-word; line-height: 1.7; word-break: break-all; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 350; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">cd ~/oneinstack
curl http://mirrors.linuxeye.com/upgrade_oneinstack.sh | bash</pre>
如何卸载?
<pre style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 11px; margin: 10px 0px; overflow: auto; display: block; color: rgb(33, 37, 41); padding: 11px 16px; border-radius: 4px; background-color: rgb(248, 248, 248); overflow-wrap: break-word; line-height: 1.7; word-break: break-all; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 350; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">~/oneinstack/uninstall.sh</pre>