[Linux] how to install and use PHP programmers in Linux
Currently, the mainstream servers are Linux systems, and the mainstream releases are CentOS. The latest CentOS version number is 7.3, and my company uses CentOS. centOS of Version x. In the Linux System of the desktop version, Ubuntu is widely used. I have installed the latest Ubuntu LTS version, I mainly talk about CentOS6.x and Ubuntu16.10.
Download Image
To learn how to install CentOS, you must install this system first. I use the VirtualBox Virtual Machine to install CentOS. At the same time, I installed Ubuntu16.10 desktop system on an obsolete notebook. Let's talk about how to press VirtualBox to press CentOS. Download and install the VirtualBox software. The installation process is the same as that of the common Windows software. You can download the CentOS image one by one, I Went To Netease's open-source image site and found that CentOS6.5 was gone. 6. if Version x has only 6.8 left, you can only install CentOS6.8. The following is an image:
http://mirrors.163.com/centos/6.8/isos/x86_64/CentOS-6.8-x86_64-minimal.iso
Only 32-bit systems can be installed on virtual machines.
Open VirtualBox. In the drop-down list of the new system, you can only install a 32-bit system. To solve this problem, you must allow CPU Hardware virtualization and disable the Hyper virtual machine service that comes with Windows. My notebook is Thinkpad e550. On the logo page after the device is started, press fn + f1 to enter the BIOS and choose setup ==> security ==> Enabled With virtualization, save and restart the service. To disable the Hyper service, go to service management to disable it.
VirtualBox is easy to install. Click "new", select a system, and proceed to the next step. Select the virtual computer, right-click the settings, find the storage, add a virtual optical drive, and select the ISO file.
Install the system
Because we press in the virtual machine, we don't have to worry about partition data. Next, we will skip detection and confirm the data to be written to the disk. The following two items are worth noting, select the Asia-Shanghai time zone and enter the root password (very important)
Solve the problem that the network is disconnected and the eth0 Nic does not exist.
After the system is installed and restarted, enter the user name root and password xxx. I entered the CentOS system because I cannot always use the terminal to run the command, I want to use SSH remote software in windows to connect to this system, so I want to know what its IP address is, view the IP address using the command ifconfig, and find that it only has one lo Nic, the address is 127.0.0.1, this is its local loopback address. It cannot be connected remotely and cannot be connected to the Internet now. I ping baidu.com and it prompts ping: unkonw host. In the VirtualBox list, right-click this virtual computer, click Settings, select Network, and select bridge Nic from the connection mode drop-down list on Network Card 1, this virtual machine is equivalent to an independent computer in the LAN. It has its own LAN ip address and can be accessed by computers in the LAN.
# Enter this directory cd/etc/sysconfig/network-scripts # edit this file vi ifcfg-eth0 # press I edit # Change ONBOOT = no to ONBOOT = yes # Press esc to exit the edit status # Press: wq: save this file # restart the network service network restart # view ipifconfig
At this time, you can see the eth0 nic and the dynamically assigned LAN ip address, for example, 192.168.2.141. Open the command line to ping 192.168.2.141 on the win system. In this case, ping the ip address. View the ip address of the win system and use ipconfig, for example, 192.168.2.145. ping 192.168.2.145 in CentOS of the VM. You can also ping the ip address. Ping baidu.com in the virtual machine to check whether the network is accessible. In this case, the ping operation is completely normal.
Remote connection
My SSH remote tool is SecureCRT, because it can open multiple tabs, It is very convenient to open multiple windows. After the download and installation are complete, right-click the session on the left, select Quick Connect, enter the host name and username root, and click connect. It will require you to enter the root secret and enter it. You can run the command in the windows software to copy and paste the command. it is not convenient to paste the command on the Virtual Machine terminal.
How to Set static IP addresses
The current ip address is dynamically allocated and may change at any time. We cannot always change the ip address during remote connection. Of course, I can leave this alone and it can be used normally before. Solve the ip will change this problem, we need to set static ip, or edit the NIC configuration file, the address is/etc/sysconfig/network-scripts/ifcfg-eth0, I will first check ipconfig on the win system to see what the mask and gateway are.
Then modify the configuration file of Linux. You must check the network of your computer and cannot copy it.
# Set static IP addresses
BOOTPROTO = static # IP Address
IPADDR = 192.168.2.100 # mask
NETMASK = 255.255.255.0 # Gateway
GATEWAY = 192.168.2.1
Service network restart the network. Now the static IP address of my virtual machine is set, and the remote connection is OK.
I did not succeed in the above setup steps during my testing at the company. The ip address segment changes every day and cannot be configured with static ip addresses. It was successful at home.
Next manual LNMP Environment Construction