Deploying Personal service on Ali cloud ubuntu

As an IT industry who generally want to have an independent blog, or a stand-alone machine. So I've been looking for the opportunity to have a machine that can independently control their own, they want doing the doing. Of course, this can also be achieved in a virtual machine or on top of your PC, but this has been driving with a server linked to the Internet experience is completely different.

 
Application
Always wanted to try Ali cloud. Before there is a free trial, I do not know whether it was a bug website, the result has been stuck in the phone verification link. And later applied for a time, and finally it.
  1. Before May and apply for a free trial, and finally succeeded;
  2. After the audit, etc., when the audit Ali cloud would call us a simple confirmation, you used to ask why, to tell you the final approval, and to configure the system it;
  3. Login account enter the site, select the appropriate system and configuration;
  4. System initialization need some time, but less than ten minutes to receive SMS notification, the server is turned on;
  5. According to ip, root password given, then Xshell log in, all OK.
Select Server
Follow the prompts, I chose Ubuntu server. As for the memory, bandwidth, hard disk, how to choose how much, anyway, is to try it! Because I chose Ubuntu server, all subsequent deployment environment, software installation is based on Ubuntu. But is Linux, in general is the same.
 
connect to the server
After the server initialization, you can connect the server. I am using Xshell (http://www.netsarang.com/download/) connection, Xshell using the ssh protocol.

Environment and deploy some basic software
 
SSH 1. (Ali cloud has been installed by default)
Of course, this has been installed by default, if not already installed, Xshell it not on the connection. But if you are a virtual machine, it is possible to install yourself. You can refer to:
"[Linux Utilities] under Ubuntu installation and use of the SSH environment" ( http://www.cnblogs.com/rond/p/3688529.html)
 
2. Samba(非常实用的同步工具)
至于Samba(用于在windows上远程同步Linux目录),这个在远程机器上面可能会有网速的限制,体验可能不怎么好,但也是一个很方便的东西,详细部署和配置可以参考:
《[Linux实用工具]Windows下同步Linux文件(Linux安装Samba和配置)》(http://www.cnblogs.com/rond/p/3688543.html)
 
2. mysql
mysql基本上是必须的,包括我后面部署wordpress的时候也要用到。mysql我用的是免安装版的,直接解压就可以使用,重点在于配置上面。可以参考之前发的文章:
《[Linux基础环境/软件]Linux下安装mysql》(http://www.cnblogs.com/rond/p/3709164.html)
 
3. resin
resin是支持jsp和java servlet的一个网站服务器。当然从resin3.1开始,resin也开始支持php了。但是不知道为什么我使用resin部署wordpress的时候总是不成功。由于resin是由java编写的,所以也要安装jdk。安装的时候还需要gcc编译。而阿里云的Ubuntu服务器默认是没有安装的。具体的安装和配置过程也可以参考之前的文章:
《[Linux基础环境/软件]Linux下安装resin web服务器(涉及gcc、jdk环境部署)》(http://www.cnblogs.com/rond/p/3711440.html)
 
4. wordpress
首先在mysql上面建立一个用于wordpress访问的用户和数据库,并且赋予访问用户相应的权限,这里默认赋予全部权限(增、删、查、改、创建)具体的mysql操作参考上面mysql配置的文章。
在wordpress官网下载最新的wordpress(http://wordpress.org/download/)有中文版本,自己选择。我尝试了两种部署方法,但是第一次部署失败了。
 
方法一
想到resin3.0开始已经支持了php,起初我是打算部署在resin4.0里面的。部署也非常简单:将wordpress解压到resin/webapps/目录下。然后配置resin/wordpress/wp-config.php文件。结果起来之后,访问是成功了,php也解析成功了,但是提示连接mysql数据库失败了。倒腾来倒腾去,最后也没有成功。只好放弃这种想法,怀疑是resin对php某些接口是不是没有支持到。作罢,只要用部署wordpress常规的方式。
 
方法二
常规做法就是LAMP环境也就是Linux+apache+mysql+php的意思。那么我们之前其实已经安装好了mysql、linux也是准备好的。因为resin替代不了apach那么这里只好安装一下apache和php。
 
安装php和apache
sudo apt-get install apache2 sudo apt-get install php5 sudo /etc/init.d/apache2 restart // 重启apache,此时php5已经可用了
安装好apache可以访问http://ip:port 试试,apache的默认端口是80。可以访问的话说明是安装apache正常了。另外在命令行输入php -v 有打印版本号的话说明php安装成功了。
 
另外修改php的配置文件php.ini,去掉extension=mysql.so的注释。
 
部署wordpress
之后将wordpress解压到/var/www/路径下。因为apache用的就是这个路径。并且编辑/var/www/wordpress/wp-config.php配置数据库的配置。
Copy the code
DB_NAME 在第二步中为WordPress创建的数据库名称 DB_USER 在第二步中创建的WordPress用户名 DB_PASSWORD 第二步中为WordPress用户名设定的密码 DB_HOST 第二步中设定的hostname(通常是localhost,但总有例外;参见编辑wp-config.php文件中的“可能的DB_HOST值)。 DB_CHARSET 数据库字符串,通常不可更改(参见zh-cn:编辑wp-config.php)。 DB_COLLATE 留为空白的数据库排序(参见zh-cn:编辑wp-config.php)。
Copy the code
然后重启apache就可以了。访问http://ip:port/wordpress/wp-admin/install.php 后面按照提示输入,点击【install wordpress】就ok了。

 
 
//=====试用总结=====
  基本上阿里云给我的感觉是非常像一台独立的机器的。其它系统我没有试用过,但是Linux系统的话给我的感觉就是这样的。会有一种自由度很高的感觉,这是sae(新浪云平台)、gae(Google App Engine)无法比拟的。当然这样无法比,人家免费的情况下照常可以托管你的代码,阿里云可是是完全商业的东西。如果要比的话也应该跟AWS来比。
  试用的效果很不错。待合适,我打算购买一个Ubuntu的系统。托管自己的博客也好,服务也好,都是很不错的。
 
//-------------------
//共勉之
  
参考文章:

"Zh-cn: install WordPress" http://codex.wordpress.org/zh-cn:%E5%AE%89%E8%A3%85_WordPress
"[Linux utility] to install and use SSH under Ubuntu environment" ( http://www.cnblogs.com/rond/p/3688529.html)
"[Linux utilities] Windows sync files in Linux (Samba Linux installation and configuration)" (http://www.cnblogs.com/rond/ the p-/ 3688543.html)
"under [Linux foundation environment / software] Linux install mysql" (http://www.cnblogs.com/rond/p/3709164.html)
installation resin under "[Linux foundation environment / software] Linux web server (involving gcc, jdk deployment environment) "(http://www.cnblogs.com/rond/p/3711440.html)

Reproduced in: https: //my.oschina.net/zhanghaiyang/blog/593328

Guess you like

Origin blog.csdn.net/weixin_34205076/article/details/92657054