没有不值得去解决的问题,也没有不值得去学习的技术!

How to Install an LNMP Stack on CentOS 7 in VirtualBox with OneinStack

Open the URL: http://127.0.0.1:9080/

1. Continuing from the previous post: https://www.shuijingwanwq.com/2016/04/16/1006/

2. I executed the command, as shown in Figure 1, and got an error indicating that yum failed. The following method resolves this:
yum -y install wget screen python #for CentOS/Redhat

yum -y install wget screen python   #for CentOS/Redhat
yum -y install wget screen python #for CentOS/Redhat

3. Based on my analysis, this error should be caused by a failed network connection. I executed the command to change ONBOOT=no to ONBOOT=yes, as shown in Figures 2 and 3:
vi /etc/sysconfig/network-scripts/ifcfg-enp0s3

vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
Change ONBOOT=no to ONBOOT=yes
Change ONBOOT=no to ONBOOT=yes

4. After saving, I restarted the network interface by executing the command, as shown in Figure 4:
service network restart

service network restart
service network restart

5. I executed the command again, and it succeeded, as shown in Figure 5:
yum -y install wget screen python #for CentOS/Redhat

yum -y install wget screen python   #for CentOS/Redhat
yum -y install wget screen python #for CentOS/Redhat

6. I executed the command to check the IP address of the current virtual machine, as shown in Figure 6:
ifconfig -a

Check the IP address of the current virtual machine
Check the IP address of the current virtual machine

7. I set up the port forwarding rules for the CentOS 7 network in VirtualBox, as shown in Figure 7:

Set up the port forwarding rules for the CentOS 7 network in VirtualBox
Set up the port forwarding rules for the CentOS 7 network in VirtualBox

8. I prepared to connect directly using PuTTY on Windows 10, as shown in Figure 8:

Prepare to connect directly using PuTTY on Windows 10
Prepare to connect directly using PuTTY on Windows 10

9. The connection succeeded, and it feels much more convenient than operating directly in the virtual machine, as shown in Figures 9 and 10:

Connection succeeded
Connection succeeded
Connection succeeded
Connection succeeded

10. wget http://mirrors.linuxeye.com/oneinstack-full.tar.gz    #Includes source code, downloadable both domestically and internationally, as shown in Figure 11:

wget http://mirrors.linuxeye.com/oneinstack-full.tar.gz #Includes source code, downloadable both domestically and internationally
wget http://mirrors.linuxeye.com/oneinstack-full.tar.gz #Includes source code, downloadable both domestically and internationally

11. Execute the command: tar xzf oneinstack-full.tar.gz, as shown in Figure 12:
cd oneinstack #If you need to modify the directories (installation, data storage, Nginx logs), please modify the options.conf file

tar xzf oneinstack-full.tar.gz
tar xzf oneinstack-full.tar.gz

12. Execute the command:

screen -S oneinstack #If the network is interrupted, you can execute the command `screen -r oneinstack` to reconnect to the installation window

13. ./install.sh     #Note: Do not execute this as sh install.sh or bash install.sh. For execution options, refer to: http://oneinstack.com/install/

14. Set up the port forwarding rules for the CentOS 7 network in VirtualBox, adding a rule to forward host port 9080 to subsystem port 80, as shown in Figure 13:

Add a rule to forward host port 9080 to subsystem port 80
Add a rule to forward host port 9080 to subsystem port 80

15. Open the URL: http://127.0.0.1:9080/ , as shown in Figure 14:

Open the URL: http://127.0.0.1:9080/
Open the URL: http://127.0.0.1:9080/

16. To add a virtual host, execute the commands. For execution options, refer to: http://oneinstack.com/install/ , as shown in Figure 15:
cd oneinstack
./vhost.sh

Add a virtual host
Add a virtual host

17. Navigate to /data/wwwroot/service.ygt.cm and create a new file named index.php, as shown in Figure 16:
cd /data/wwwroot/service.ygt.cm
vim index.php

Navigate to /data/wwwroot/service.ygt.cm and create a new file named index.php
Navigate to /data/wwwroot/service.ygt.cm and create a new file named index.php

18. Open the URL: http://service.ygt.cm:9080/ , as shown in Figure 17:

Open the URL: http://service.ygt.cm:9080/
Open the URL: http://service.ygt.cm:9080/

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系