Home >Backend Development >PHP Tutorial >Alibaba Cloud ECS server Win2003 conversion CentOS7.2 full record

Alibaba Cloud ECS server Win2003 conversion CentOS7.2 full record

WBOY
WBOYOriginal
2016-12-01 00:25:511223browse

I am posting this article to record and share it. Although it is very elementary stuff, I still hope it will be helpful if someone doesn’t understand it. Someone asked me if I would be criticized if I posted something that looked like an article in the Q&A. In fact, there is a problem with my article, because I haven't figured out the automatic deployment of git webhook, because I really don't want to enable shell_exec permissions, and I don't know if there is any good way to achieve automatic deployment.

Foreword & Background:


The original Alibaba Cloud server is Win2003 (40G system disk + 70G data disk). The system runs PHP system. Using Win as a server is already nonsense. Unfortunately, I have never touched Linux, so I have not changed it. System;

It turned out that the code was modified locally and then FTPed to the server. It was too low. I saw the automatic deployment of Webhook written by @安正超神, so I started to do it. I found that the various permissions under Win2003 are really annoying; I took this opportunity , just muster up the courage to change the system and embrace CentOS7.2.

Preparation


Because I have never touched Linux, I have done a lot of preparations and homework; I found that the biggest problem is the processing of the 70G data disk, because after changing from Win to CentOS, it will definitely not be mounted; Alibaba engineers The solution given is to use Ntfs-3G to read. Although I don't know the quality of this thing, I still want to format and mount this data disk in the way that Linux recognizes.

This involves a problem of data backup locally and back transmission. There are about 6G of attachment data in my data disk, all of which are pictures. It takes 5 hours to package the backup and download it locally, and 5 hours to upload it, which is too long; A friend from SF gave me the suggestion to temporarily buy OSS and transfer it there and then transfer it back. I would like to thank these two friends for temporarily buying a cloud disk and transferring it there and then back. However, I finally packaged it and downloaded it locally. I am uploading the zip to the server when I post this. .

Officially begins

  • Deactivate the instance, change the system disk, select CentOS7.2 x64 > Successfully

  • SSH to the server: fdisk -l and find that the disk has been partitioned

  • The one-click environment I use is Pagoda bt.cn, and I need to mount the data disk to the /www directory, so

<code>mkdir -p /www</code>
  • Format data disk

<code>mkfs.ext4 /dev/xvdb1</code>
  • Mount the data disk to the /www directory

<code>echo "/dev/xvdb1         /www         ext4           defaults            0 0" >> /etc/fstab</code>
  • Reload all partitions

<code>mount -a</code>
  • Check if it is successful (success)

<code>df -h</code>
  • Check whether git is installed, Alibaba’s CentOS comes with git 1.8.x

<code>git --version</code>
  • Clone the project to the www directory

<code>git clone http://coding.com.....</code>
  • Restore database

  • Use the Pagoda panel to create a new site and specify the project directory; the site access is successful.

  • Generate deployment formula and test git pull; no problems.

The project has now resumed operation, except that attachments are still being uploaded. In the past, capitalization issues were not considered when developing under Win. No capitalization issues have been found in simple test projects.

Because the shell_exec command is too dangerous. If you let hook.php trigger shell_exec ('git pull'), it will be miserable once the system has a vulnerability and is exploited by illegal elements to execute shell_exec. For now, it is better to manually ssh to the server and pull manually, or Use the scheduled tasks in the Pagoda background.

Celebrating the last picture, by the way, thank you to Baota Linux Assistant bt.cn, Baota Engineer A Liang, @gleilei, @laminux29

Alibaba Cloud ECS server Win2003 conversion CentOS7.2 full record

Reply content:

I am posting this article to record and share it. Although it is very elementary stuff, I still hope it will be helpful if someone doesn’t understand it. Someone asked me if I would be criticized if I posted something that looked like an article in the Q&A. In fact, there is a problem with my article, because I haven't figured out the automatic deployment of git webhook, because I really don't want to enable shell_exec permissions, and I don't know if there is any good way to achieve automatic deployment.

Foreword & Background:


The original Alibaba Cloud server is Win2003 (40G system disk + 70G data disk). The system runs PHP system. Using Win as a server is already nonsense. Unfortunately, I have never touched Linux, so I have not changed it. System;

It turned out that the code was modified locally and then FTPed to the server. It was too low. I saw the automatic deployment of Webhook written by @安正超神, so I started to do it. I found that the various permissions under Win2003 are really annoying; I took this opportunity , just muster up the courage to change the system and embrace CentOS7.2.

Preparation


Because I have never touched Linux, I have done a lot of preparations and homework; I found that the biggest problem is the processing of the 70G data disk, because after changing from Win to CentOS, it will definitely not be mounted; Alibaba engineers The solution given is to use Ntfs-3G to read. Although I don't know the quality of this thing, I still want to format and mount this data disk in the way that Linux recognizes.

This involves a problem of data backup locally and back transmission. There are about 6G of attachment data in my data disk, all of which are pictures. It takes 5 hours to package the backup and download it locally, and 5 hours to upload it, which is too long; A friend from SF gave me the suggestion to temporarily buy OSS and transfer it there and then transfer it back. I would like to thank these two friends for temporarily buying a cloud disk and transferring it there and then back. However, I finally packaged it and downloaded it locally. I am uploading the zip to the server when I post this. .

Officially begins

  • Deactivate the instance, change the system disk, select CentOS7.2 x64 > Successfully

  • SSH to the server: fdisk -l and find that the disk has been partitioned

  • The one-click environment I use is Pagoda bt.cn, and I need to mount the data disk to the /www directory, so

<code>mkdir -p /www</code>
  • Format data disk

<code>mkfs.ext4 /dev/xvdb1</code>
  • Mount the data disk to the /www directory

<code>echo "/dev/xvdb1         /www         ext4           defaults            0 0" >> /etc/fstab</code>
  • Reload all partitions

<code>mount -a</code>
  • Check if it is successful (success)

<code>df -h</code>
  • Check whether git is installed, Alibaba’s CentOS comes with git 1.8.x

<code>git --version</code>
  • Clone the project to the www directory

<code>git clone http://coding.com.....</code>
  • Restore database

  • Use the Pagoda panel to create a new site and specify the project directory; the site access is successful.

  • Generate deployment formula and test git pull; no problems.

The project has now resumed operation, except that attachments are still being uploaded. In the past, capitalization issues were not considered when developing under Win. No capitalization issues have been found in simple test projects.

Because the shell_exec command is too dangerous. If you let hook.php trigger shell_exec ('git pull'), it will be miserable once the system has a vulnerability and is exploited by illegal elements to execute shell_exec. For now, it is better to manually ssh to the server and pull manually, or Use the scheduled tasks in the Pagoda background.

Celebrating the last picture, by the way, thank you to Baota Linux Assistant bt.cn, Baota Engineer A Liang, @gleilei, @laminux29

Alibaba Cloud ECS server Win2003 conversion CentOS7.2 full record

It feels a bit sad to see you all struggling with dozens of gigabytes for such a long time to save money, while I have done nothing with a new blade cluster and a self-built BGP computer room with storage mounts, just wasting electricity.

You can play with Docker, use Docker to deploy jenkins, do continuous integration, git upload, automatic server testing, deployment and release. You can also use Docker to deploy a gitlab and make your own git server.

I really want to know if you will be downvoted if you post your article in the question...

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn