购买Linux VPS之后的一些基础操作步骤 | 顾建伟个人博客
现在的位置: 首页 > 电脑相关 > 正文
购买Linux VPS之后的一些基础操作步骤
2014年06月26日 电脑相关 ⁄ 共 5315字 评论数 9

分享到:


本教程不仅限于衡天主机,也适用于其他LINUX VPS

许多朋友在拿到VPS的ip和root密码之后不知道下一步该怎么做。

其实首先需要明确一个目的“你买VPS是要做什么?为什么买VPS?”

有了这个目的就好办了。有的朋友说“我要放网站”

那么,你要放什么程序?不同的程序所需求的环境是不一样的,例如 WordPress 和 Typecho 需要 PHP+MysqlGHost 需要 Nodejs 。

而且不同的程序需要的软件版本也不一样,例如许多软件要求PHP版本为5.2,有一些则要求PHP版本为5.3 。

都需要根据软件的需求来安装合适版本的软件。

有位朋友要安装 PHPCMS,我查了一下,是需要 PHP5.2,在 PHP5.3 下运行问题比较多。

那么就开始部署吧。

我个人比较推荐使用一键包或者使用面板。

AMH http://www.amysql.com/AMH.htm

virtualmin http://www.virtualmin.com/

WDCP http://www.wdlinux.cn/wdcp/

LNMP http://lnmp.org/

DirectAdmin http://www.directadmin.com/

新手朋友比较推荐付费的DirectAdmin和免费的AMH。

因为 PHPCMS 需要 PHP5.2 版本,并且这位朋友也是新手,所以就安装 DirectAdmin 了。


首先,链接SSH客户端,推荐使用 Putty 和 Xshell

链接后使用 cat /etc/redhat-release 命令查看当前服务器版本。

[root@vps ~]# cat /etc/redhat-release   
CentOS release 6.5 (Final)

查看32或者64bits

[root@vps ~]# uname -a
Linux vps.xxx.com 2.6.32-431.el6.i686 #1 SMP Fri Nov 22 00:26:36 UTC 2013 i686 i686 i386 GNU/Linux

开始部署

安装依赖

yum -y install unzip zip lftp tar quota nano mutt gcc gcc-c++ flex make perl gd bison  openssl-devel bind patch libaio screen

建立screen会话【一定要建立screen会话,不然SSH断开就坏了】

screen -S DA

下载安装脚本

wget http://www.directadmin.com/setup.sh
chmod 755 setup.sh

执行安装脚本

./setup.sh

然后会要求输入授权ID和客户ID (这个可以到官方网站购买)

Please enter your Client ID : 0000 #这里输入Client ID
Please enter your License ID : 0000 #这里输入License ID
Please enter your hostname \(server.domain.com\)
It must be a Fully Qualified Domain Name
Do *not* use a domain you plan on using for the hostname:
eg. don't use domain.com. Use server.domain.com instead.
Do not enter http:// or www

Enter your hostname (FQDN) : vps.123.com ##这里输入hostname,不建议使用自己的域名,可以随便写个
Client ID:  0000
License ID: 0000
Hostname: vps.shebao12333.com
Is this correct? (y,n) : y  #确认以上信息是否有误,没有错误输入y
Is eth0 your network adaptor with the license IP (103.000.00.000)? (y,n) : y #确认IP是否有误,无误输入y
Is 103.000.00.000 the IP in your license? (y,n) : y #确认该IP是否为授权IP,无误输入y
Is this correct? (y,n) : y  #再次确认是否正确,正确输入y

......

You now have 4 options for your apache/php setup.

1: customapache:         end-of-life software.  Apache 1.3, php 4, frontpage.  Do not use.  No support.
2: custombuild 1.1:      older software.  Apache 2.x, php 4, 5, or both in cli and/or suphp. Defaults to php 5.2
3: custombuild 1.2:      * Recommended. simlar to 1.1, newer default versions.  Apache 2.x, php 5, 6, or both in cli and/or suphp. Defaults to php 5.3
4: custombuild 2.0 ALPHA: Not yet recommended, still in testing. Apache 2.4, mod_ruid2, php 5.4. Can be set to use php-FPM. Experts only. Requires pre-release binaries.

      Post any issues with custombuild to the forum: http://www.directadmin.com/forum/forumdisplay.php?f=61

Enter your choice (1, 2, 3 or 4): 2 #根据需求选择你的软件版本
You have chosen custombuild 1.1.
--2014-06-19 10:10:40--  http://files.directadmin.com/services/custombuild/1.1/custombuild/build
Resolving files.directadmin.com... 69.30.193.202, 216.144.254.90
Connecting to files.directadmin.com|69.30.193.202|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 320299 (313K) [text/plain]
Saving to: `/usr/local/directadmin/custombuild/build'

100%[=======================================================================================================================================================================================>] 320,299      222K/s   in 1.4s    

2014-06-19 10:10:43 (222 KB/s) - `/usr/local/directadmin/custombuild/build' saved [320299/320299]

Would you like the default settings of apache 2.2 and php 5.2 cli? (y/n): n
You have chosen to customize the custombuild options.  Please wait while options configurator is downloaded... 

Cannot find /usr/local/directadmin/custombuild/options.conf, writing defaults.
Downloading             versions.txt...
--2014-06-19 10:10:49--  http://files.directadmin.com/services/custombuild/versions.txt
Resolving files.directadmin.com... 69.30.193.202, 216.144.254.90
Connecting to files.directadmin.com|69.30.193.202|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8471 (8.3K) [text/plain]
Saving to: `/usr/local/directadmin/custombuild/versions.txt'

100%[=======================================================================================================================================================================================>] 8,471       22.0K/s   in 0.4s    

2014-06-19 10:10:49 (22.0 KB/s) - `/usr/local/directadmin/custombuild/versions.txt' saved [8471/8471]
#以下内容根据需求选择即可
Would you like to backup the current options.conf? (yes/no): yes
Backup created: /usr/local/directadmin/custombuild/options.conf.20140619101106.backup
Would you like to have PHP4 or PHP5 as default? (4/5): 5
Would you like to have PHP5? (yes/no): yes
Would you like to have PHP5 as CLI or CGI? (cli/cgi): cgi
Would you like to have PHP4? (yes/no): no
Would you like to have ionCube? (yes/no): yes
Would you like to have Zend Optimizer? (yes/no): yes
Would you like to have an ability to update/instal MySQL using CustomBuild? (yes/no): yes
Which version of MySQL you would like to have? (5.0/5.1/5.5/5.6): 5.5
Which version of Apache you would like to have? (1.3/2.0/2.2/2.4): 2.2
Would you like to prevent htaccess files from using Options FollowSymLinks? More secure, but may break scripts. (yes/no): yes
Would you like to have an ability to update/instal Exim using CustomBuild? (yes/no): no
Would you like to have an ability to install Dovecot? (yes/no): no
Would you like to have an ability to install/update phpMyAdmin using CustomBuild? (yes/no): yes
Would you like to have an ability to install/update SquirrelMail webmail using CustomBuild? (yes/no): no
Would you like to have an ability to install/update RoundCube webmail using CustomBuild? (yes/no): no
Would you like to have an ability to install/update UebiMiau webmail using CustomBuild (not recommended)? (yes/no): no
Would you like to have an ability to install/update Atmail Open webmail using CustomBuild? (yes/no): no
Would you like to search for the fastest download mirror? (y/n): y #开始测速,并开始编译。

好了,关掉SSH,休息一会。

过上1个小时,回来用 screen -r 打开看安装完成的密码。

安装好之后参考 http://hengtian.biz/191.shtml 来建站。

说出你的想法!
有事加我的QQ:932404999(微博ID:顾建伟个人博客网)
×