如何使用 VPS 搭建 JetBrains 编辑器激活服务器
2018-02-24 本文已影响275人
斐波那契额
安装环境:
Ubuntu 16.04 LTS
安装步骤:
1. 更新系统
sudo apt-get update
sudo apt-get upgrade
如果出现以下错误:
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
请尝试:
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
sudo dpkg --configure -a
2. 下载反代工具, 可用于激活JRebel
下载作者lanyu提供的服务端,基本上覆盖了所有类型的操作系统,从 Windows
到 mac
都有:
GitHub: https://github.com/ilanyu/ReverseProxy/releases/latest
使用方法详解:
./ReverseProxy_[OS]_[ARCH] -h
Usage of ReverseProxy_[OS]_[ARCH]:
-l string
listen on ip:port (default "0.0.0.0:8888")
-r string
reverse proxy addr (default "http://idea.lanyus.com:80")
./ReverseProxy_windows_amd64.exe -l "0.0.0.0:8081" -r "https://www.baidu.com"
Listening on 0.0.0.0:8081, forwarding to https://www.baidu.com
默认反代 idea.lanyus.com
, 运行起来后, http://127.0.0.1:8888/JRebel用户名
就是激活地址了, 邮箱随意填写, 当然, 也可用于idea
具体步骤:
wget https://github.com/ilanyu/ReverseProxy/releases/download/v1.0/ReverseProxy_linux_amd64
chmod -R 777 ReverseProxy_linux_amd64
nohup /Users/such/Jetbrains/IdeaServer -l 0.0.0.0:9527 &>/dev/null &
设置为后台运行,并加入开机启动。我没有使用launchctl,而是直接加入开机启动项(大家自行百度即可)
3. nginx 配置代理
sudo apt-get install nginx
cd /etc/nginx/sites-available && vim default
server {
listen 80;
server_name idea.ellison.com; # 此处配置的域名便是需要的 Lisence Server
location / {
proxy_pass http://127.0.0.1:9527; # 运行的服务端端口
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
nginx -s reload
4. 搭建完成, 测试
激活地址: http://你的 VPS IP 地址:9527