一、福利内容
IBM 高配置服务器免费使用 120 天,配置如下:
- CPU: 2 core(s)
- Mem: 4096 MB
- Disk: 40GB
二、获取福利
1、注册
注册地址:IBM LinuxONE Community Cloud
按页面要求填写相应资料即可(截图已做翻译),需要注意的是会有短信验证,因此号码一定要可以接收短信,另外资料尽量真实吧,提交后账号密码会通过邮件发送到注册填写的邮箱:
2、开通
登录地址:IBM LinuxONE Community Cloud
登录后可以看到所有能操作的功能了:
我们要开通的就是第一个虚拟服务器(Virtual Servers)了,当然你要使用其他功能也不冲突,首先导入 SSH KEY:
可以导入或直接创建,会玩这个的都知道 KEY 怎么创建,不会的可参见:PUTTYGEN - KEY GENERATOR FOR PUTTY ON WINDOWS,不再赘述,创建后回到首页点击管理实例(Manage Instances):
然后创建实例(Create),每个账户只能建一个实例,可以选择最高的:
点击创建(Create)后稍等片刻即可创建成功,IP 地址和用户名:
3、管理
上一步我们已经知道了 IP 地址和用户名,那么我们就可以用 Xshell 或类似的软件来管理服务器:
ssh linux1@ip
登录后可通过下列命令切换成管理员:
[linux1@wp ~]$ sudo -i
[root@wp ~]#
如果连不上,出现如下图错误,说明需要更新客户端了:
4、使用
虽然配置很高,但由于架构是 IBM 独有的 s390x,因此基本上也只能使用 yum 安装或者源码安装软件,这一点请知悉。
下面说说 Docker 在这上面的安装使用。
网上的教程都是在讲 x86_64 或者 x86 上的安装,总结起来简单一句命令即可:
[root@wp ~]# wget -qO- https://get.docker.com/ | sh && docker -v
但由于架构问题,并不适合在 Redhat 上使用:
WARNING: rhel is now only supported by Docker EE
Check https://store.docker.com for information on Docker EE
而 Docker EE 又是收费的,那么难道没有办法跑 Docker 了吗?显示是可以的。
[root@wp ~]# wget https://download.docker.com/linux/static/stable/s390x/docker-17.06.2-ce.tgz
[root@wp ~]# tar zxf docker-17.06.2-ce.tgz
[root@wp ~]# mv docker/* /usr/bin/ && rm -rf docker*
[root@wp ~]# chown root:root /usr/bin/docker*
[root@wp ~]# chmod +x /usr/bin/docker*
[root@wp ~]# nohup dockerd 2>&1 &
此时便可以使用 docker 相关命令了,先让我们看下版本:
[root@wp ~]# docker -v
Docker version 17.06.2-ce, build cec0b72
简单跑个 Ubuntu 容器看看:
[root@wp ~]# docker pull ubuntu:16.04
16.04: Pulling from library/ubuntu
04bba6f6626b: Pull complete
eb360dc7c011: Pull complete
d937301f048f: Pull complete
d560dd7c61a1: Pull complete
84dcf3356243: Pull complete
Digest: sha256:ec0e4e8bf2c1178e025099eed57c566959bb408c6b478c284c1683bc4298b683
Status: Downloaded newer image for ubuntu:16.04
[root@wp ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu 16.04 fd72ed8ba5c5 5 weeks ago 121MB
[root@wp ~]# docker run -t -i -d ubuntu:16.04
54c9af52e975bf3981645bd2a995e2414e9a7c07f064fb2fc44c52b4c68ca53a
[root@wp ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
54c9af52e975 ubuntu:16.04 "/bin/bash" 40 seconds ago Up 39 seconds quirky_noyce
[root@wp ~]# docker exec -it quirky_noyce /bin/bash
root@54c9af52e975:/# apt update && apt upgrade -y
Get:1 http://ports.ubuntu.com/ubuntu-ports xenial InRelease [247 kB]
......
Fetched 23.5 MB in 2s (8377 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
2 packages can be upgraded. Run 'apt list --upgradable' to see them.
Get:1 http://ports.ubuntu.com/ubuntu-ports xenial-updates/main s390x dpkg s390x 1.18.4ubuntu1.3 [2109 kB]
......
Setting up libdb5.3:s390x (5.3.28-11ubuntu0.1) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
root@54c9af52e975:/# apt install nginx -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
fontconfig-config fonts-dejavu-core geoip-database libexpat1 libfontconfig1 libfreetype6 libgd3 libgeoip1 libicu55 libjbig0 libjpeg-turbo8 libjpeg8
libpng12-0 libssl1.0.0 libtiff5 libvpx3 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxml2 libxpm4 libxslt1.1 nginx-common nginx-core sgml-base ucf
xml-core
......
Processing triggers for systemd (229-4ubuntu21) ...
root@54c9af52e975:/# service nginx start
* Starting nginx nginx [ OK ]
root@54c9af52e975:/# netstat -antlp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 752/nginx
tcp6 0 0 :::80 :::* LISTEN 752/nginx
root@54c9af52e975:/# exit
[root@wp ~]# docker rm 54c9af52e975
[root@wp ~]# docker rmi fd72ed8ba5c5
提醒一下,此版本不支持 -P 等命令,但有说可以通过 iptables 转发,我没试:
[root@wp ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
54c9af52e975 ubuntu:16.04 "/bin/bash" 40 seconds ago Up 39 seconds quirky_noyce
[root@wp ~]# docker inspect quirky_noyce | grep IPAddress
"SecondaryIPAddresses": null,
"IPAddress": "172.17.0.2",
"IPAddress": "172.17.0.2",
[root@wp ~]# iptables -t nat -A DOCKER -p tcp --dport 80 -j DNAT --to-destination 172.17.0.2:80
[root@wp ~]# docker start 54c9af52e975
54c9af52e975
[root@wp ~]# docker attach 54c9af52e975
root@54c9af52e975:/# nginx
root@54c9af52e975:/# netstat -antlp
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 16/nginx: master pr
tcp6 0 0 :::80 :::* LISTEN 16/nginx: master pr
如果想查看 docker 更多使用方法,可以执行:
[root@wp ~]docker
当然了,这里只是做个小演示,肯定还有其他更好方法去跑 docker,大家可以多试试。
参考文章:
1、《ibm linuxone community cloud免费120天试用》
2、《PUTTYGEN - KEY GENERATOR FOR PUTTY ON WINDOWS》
3、《IBMLinuxONE:可免费试用120天高配VPS》
Windows 7Chrome 31.0.1650.63来自 湖北 的大神
大佬厉害,有docker就可以装酸酸了~
这个版本的 docker 似乎并不支持 expose port,需要再去找找
Windows 10Firefox 43.0来自 莫斯科 的大神
Click Here!