<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>小生这厢有礼了(BioFaceBook Personal Blog) &#187; 服务器管理</title>
	<atom:link href="http://www.biofacebook.com/?cat=10&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.biofacebook.com</link>
	<description>记录生物信息学点滴足迹（NGS,Genome,Meta,Linux)</description>
	<lastBuildDate>Sun, 23 Aug 2020 03:28:53 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.41</generator>
	<item>
		<title>Docker + Trojan + Caddy 部署 ( 转贴）</title>
		<link>http://www.biofacebook.com/?p=1455</link>
		<comments>http://www.biofacebook.com/?p=1455#comments</comments>
		<pubDate>Wed, 26 Feb 2020 13:43:27 +0000</pubDate>
		<dc:creator><![CDATA[szypanther]]></dc:creator>
				<category><![CDATA[docker]]></category>
		<category><![CDATA[服务器管理]]></category>

		<guid isPermaLink="false">http://www.biofacebook.com/?p=1455</guid>
		<description><![CDATA[<p>SourceURL:https://muguang.me/it/2757.html</p> Docker + Trojan + Caddy 部署 关于 Trojan，不要多问，问就是代理工具。它先进的地方在于，数据传输使用 TLS 协议，伪装成 HTTPS 请求。Trojan 服务端监听 443 端口，对于普通来路的请求，会交由 Web 服务器处理，返回 Web 网站；而对于 Trojan 客户端来的请求，则由 Trojan 服务端进行代理。这跟 某2ray + Websocket + TLS 原理是一样的，都是通过伪装流量，避免被提取特征或是被检测。 <p>这篇文章里，我将使用 Ubuntu 18.04 操作系统，使用 Caddy 作为 Web 服务器，将 Trojan 服务端和 Caddy 部署到 Docker 中。</p> 0、准备 域名 x1 国外服务器 x1 <p>部署前先给域名设置一条 A 记录，并指向你的服务器 IP。</p> 1、安装 Docker [...]]]></description>
				<content:encoded><![CDATA[<p>SourceURL:https://muguang.me/it/2757.html</p>
<div class="wrapper">
<article class="content">
<h1>Docker + Trojan + Caddy 部署</h1>
<div class="meta">关于 <a href="https://url.cn/5h1YHqK" target="_blank">Trojan</a>，不要多问，问就是代理工具。它先进的地方在于，数据传输使用 TLS 协议，伪装成 HTTPS 请求。Trojan 服务端监听 443 端口，对于普通来路的请求，会交由 Web 服务器处理，返回 Web 网站；而对于 Trojan 客户端来的请求，则由 Trojan 服务端进行代理。这跟 某2ray + Websocket + TLS 原理是一样的，都是通过伪装流量，避免被提取特征或是被检测。</div>
<div class="post">
<p>这篇文章里，我将使用 Ubuntu 18.04 操作系统，使用 Caddy 作为 Web 服务器，将 Trojan 服务端和 Caddy 部署到 Docker 中。</p>
<h3>0、准备</h3>
<ul>
<li>域名 x1</li>
<li>国外服务器 x1</li>
</ul>
<p>部署前先给域名设置一条 A 记录，并指向你的服务器 IP。</p>
<h3>1、安装 Docker &amp; Docker-Compose</h3>
<ul>
<li>添加 Docker 软件源
<div class="code-toolbar">
<pre class="line-numbers language-shell"><code class=" language-shell"><span class="token function">sudo</span> <span class="token function">apt-get</span> update
<span class="token function">sudo</span> <span class="token function">apt-get</span> <span class="token function">install</span> apt-transport-https ca-certificates  <span class="token function">curl</span> software-properties-common
<span class="token function">curl</span> -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg <span class="token operator">|</span> <span class="token function">sudo</span> apt-key add -
<span class="token function">sudo</span> add-apt-repository <span class="token string">"deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu <span class="token variable"><span class="token variable">$(</span>lsb_release -cs<span class="token variable">)</span></span> stable"</span>
</code></pre>
<div class="shelter"></div>
<div class="toolbar">
<div class="toolbar-item">Shell</div>
<div class="toolbar-item"><button><i id="btn-copy-code" class="fontello fontello-tags"> Copy</i></button></div>
</div>
</div>
</li>
<li>安装 Docker CE（社区版）
<div class="code-toolbar">
<pre class="line-numbers language-shell"><code class=" language-shell"><span class="token function">sudo</span> <span class="token function">apt-get</span> update -y
<span class="token function">sudo</span> <span class="token function">apt-get</span> <span class="token function">install</span> docker-ce -y</code></pre>
<div class="shelter"></div>
<div class="toolbar">
<div class="toolbar-item">Shell</div>
<div class="toolbar-item"><button><i id="btn-copy-code" class="fontello fontello-tags"> Copy</i></button></div>
</div>
</div>
</li>
<li>安装 Docker-compose 容器编排工具
<div class="code-toolbar">
<pre class="line-numbers language-shell"><code class=" language-shell"><span class="token function">sudo</span> <span class="token function">curl</span> -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-<span class="token variable"><span class="token variable">`</span><span class="token function">uname</span> -s<span class="token variable">`</span></span>-<span class="token variable"><span class="token variable">`</span><span class="token function">uname</span> -m<span class="token variable">`</span></span> -o /usr/local/bin/docker-compose
<span class="token function">sudo</span> <span class="token function">chmod</span> +x /usr/local/bin/docker-compose
docker-compose --version</code></pre>
<div class="shelter"></div>
<div class="toolbar">
<div class="toolbar-item">Shell</div>
<div class="toolbar-item"><button><i id="btn-copy-code" class="fontello fontello-tags"> Copy</i></button></div>
</div>
</div>
</li>
</ul>
<h3>2、构建 Trojan + Caddy 镜像</h3>
<p>我已经写好了 Docker compose 的构建脚本，直接克隆下来用即可。</p>
<ul>
<li>下载 Trojan + Caddy 构建配置，见 <a href="https://github.com/FaithPatrick/trojan-caddy-docker-compose/" target="_blank">GitHub</a>
<div class="code-toolbar">
<pre class="line-numbers language-shell"><code class=" language-shell"><span class="token function">git</span> clone git@github.com:FaithPatrick/trojan-caddy-docker-compose.git trojan-caddy-docker-compose <span class="token operator">&amp;&amp;</span> <span class="token function">cd</span> trojan-caddy-docker-compose</code></pre>
<div class="shelter"></div>
<div class="toolbar">
<div class="toolbar-item">Shell</div>
<div class="toolbar-item"><button><i id="btn-copy-code" class="fontello fontello-tags"> Copy</i></button></div>
</div>
</div>
</li>
<li>编辑 <code>./caddy/Caddyfile</code>
<div class="code-toolbar">
<pre class="line-numbers language-caddyfile"><code class=" language-caddyfile">www.yourdomain.com:80 {
    root /usr/src/trojan
    log /usr/src/caddy.log
    index index.html
}

www.yourdomain.com:443 {
    root /usr/src/trojan
    log /usr/src/caddy.log
    index index.html
}</code></pre>
<div class="shelter"></div>
<div class="toolbar">
<div class="toolbar-item">Caddyfile</div>
<div class="toolbar-item"><button><i id="btn-copy-code" class="fontello fontello-tags"> Copy</i></button></div>
</div>
</div>
<p>将 <code>www.yourdomain.com</code> 替换成事先准备的域名。</li>
<li>编辑 <code>./trojan/config/config.json</code><br />
在 <code>config:json:8</code> 位置，将 <code>your_password</code> 替换成要设置的密码，这是客户端需要用到的密码，妥善保管。</p>
<p>在 <code>config:json:12-13</code> 位置将 <code>your_domain_name</code> 替换成自己的域名, 这个路径是 Caddy 自动调用 Let&#8217;s encrypt 生成的证书路径。</p>
<ul>
<li>执行 <code>docker-compose build</code> 构建镜像，如果没什么报错就代表成功了。</li>
</ul>
</li>
</ul>
<h3>3、运行 Trojan + Caddy 容器</h3>
<p>执行 <code>docker-compose up</code> 命令启动容器，正常启动的日志应该看起来是这样的：</p>
<div class="code-toolbar">
<pre class="line-numbers language-shell"><code class=" language-shell">➜ docker-compose up

Starting test_caddy_1 <span class="token punctuation">..</span>. <span class="token keyword">done</span>
Attaching to test_caddy_1
caddy_1  <span class="token operator">|</span> Activating privacy features<span class="token punctuation">..</span>.
caddy_1  <span class="token operator">|</span>
caddy_1  <span class="token operator">|</span> Your sites will be served over HTTPS automatically using Let<span class="token string">'s Encrypt.
caddy_1  | By continuing, you agree to the Let'</span>s Encrypt Subscriber Agreement at:
caddy_1  <span class="token operator">|</span>   https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf
caddy_1  <span class="token operator">|</span> Please enter your email address to signify agreement and to be notified
caddy_1  <span class="token operator">|</span> <span class="token keyword">in</span> <span class="token keyword">case</span> of issues. You can leave it blank, but we don't recommend it.
caddy_1  <span class="token operator">|</span>   Email address: 2020/01/10 13:54:58 <span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> acme: Registering account <span class="token keyword">for</span>
caddy_1  <span class="token operator">|</span> 2020/01/10 13:54:58 <span class="token punctuation">[</span>INFO<span class="token punctuation">]</span><span class="token punctuation">[</span>xx.xx.xx<span class="token punctuation">]</span> acme: Obtaining bundled SAN certificate
caddy_1  <span class="token operator">|</span> 2020/01/10 13:54:58 <span class="token punctuation">[</span>INFO<span class="token punctuation">]</span><span class="token punctuation">[</span>xx.xx.xx<span class="token punctuation">]</span> AuthURL: https://acme-v02.api.letsencrypt.org/acme/authz-v3/xxxxxx
caddy_1  <span class="token operator">|</span> 2020/01/10 13:54:58 <span class="token punctuation">[</span>INFO<span class="token punctuation">]</span><span class="token punctuation">[</span>xx.xx.xx<span class="token punctuation">]</span> acme: Trying to solve HTTP-01
caddy_1  <span class="token operator">|</span> 2020/01/10 13:54:58 <span class="token punctuation">[</span>INFO<span class="token punctuation">]</span><span class="token punctuation">[</span>xx.xx.xx<span class="token punctuation">]</span> Served key authentication
caddy_1  <span class="token operator">|</span> 2020/01/10 13:54:58 <span class="token punctuation">[</span>INFO<span class="token punctuation">]</span><span class="token punctuation">[</span>xx.xx.xx<span class="token punctuation">]</span> Served key authentication
caddy_1  <span class="token operator">|</span> 2020/01/10 13:55:03 <span class="token punctuation">[</span>INFO<span class="token punctuation">]</span><span class="token punctuation">[</span>xx.xx.xx<span class="token punctuation">]</span> The server validated our request
caddy_1  <span class="token operator">|</span> 2020/01/10 13:55:03 <span class="token punctuation">[</span>INFO<span class="token punctuation">]</span><span class="token punctuation">[</span>xx.xx.xx<span class="token punctuation">]</span> acme: Validations succeeded<span class="token punctuation">;</span> requesting certificates
caddy_1  <span class="token operator">|</span> 2020/01/10 13:55:04 <span class="token punctuation">[</span>INFO<span class="token punctuation">]</span><span class="token punctuation">[</span>xx.xx.xx<span class="token punctuation">]</span> Server responded with a certificate.
caddy_1  <span class="token operator">|</span> 2020/01/10 13:55:04 <span class="token punctuation">[</span>INFO<span class="token punctuation">]</span><span class="token punctuation">[</span>xx.xx.xx<span class="token punctuation">]</span> Certificate written to disk: /root/.caddy/acme/acme-v02.api.letsencrypt.org/sites/xx.xx.xx/xx.xx.xx.crt
caddy_1  <span class="token operator">|</span> done.

Starting test_trojan_1 <span class="token punctuation">..</span>. <span class="token keyword">done</span>
Attaching to test_caddy_1, test_trojan_1
trojan_1  <span class="token operator">|</span> ssl certs is empty - checking<span class="token punctuation">..</span>.
trojan_1  <span class="token operator">|</span> ssl certs is empty - checking<span class="token punctuation">..</span>.
trojan_1  <span class="token operator">|</span> Welcome to trojan 1.14.0
trojan_1  <span class="token operator">|</span> <span class="token punctuation">[</span>2020-01-10 15:40:58<span class="token punctuation">]</span> <span class="token punctuation">[</span>WARN<span class="token punctuation">]</span> trojan <span class="token function">service</span> <span class="token punctuation">(</span>server<span class="token punctuation">)</span> started at 0.0.0.0:443</code></pre>
<div class="shelter"></div>
<div class="toolbar">
<div class="toolbar-item">Shell</div>
<div class="toolbar-item"><button><i id="btn-copy-code" class="fontello fontello-tags"> Copy</i></button></div>
</div>
</div>
<p>如果想常驻进程，启动容器时执行 <code>docker-compose up -d</code> 。</p>
<p>用浏览器访问 <code>https://域名</code> 看一下返回，我的构建脚本默认会返回 Bootstrap 的起始页面：</p>
<p><img src="https://muguang.me/usr/uploads/2020/01/1221849849.png" alt="20200111012712.png" /></p>
<p>网站存放在 <code>./wwwroot/trojan/</code> 目录下面 ，可以随便放点什么，尽可能像一个正常网站就好。</p>
<p>至此，Docker + Trojan + Caddy 服务端部署完成。</p>
<h3>4、Trojan 客户端</h3>
<p>不多提了，Windows 和 macOS 客户端官方仓库都有：<a href="https://url.cn/5r6mb9J" target="_blank">https://url.cn/5r6mb9J</a><br />
当然，你也可以去寻找更易用的支持 Trojan 的第三方客户端或路由器固件。</p>
</div>
</article>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.biofacebook.com/?feed=rss2&#038;p=1455</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu中v2ray客户端配置实例</title>
		<link>http://www.biofacebook.com/?p=1411</link>
		<comments>http://www.biofacebook.com/?p=1411#comments</comments>
		<pubDate>Sat, 12 Oct 2019 07:51:14 +0000</pubDate>
		<dc:creator><![CDATA[szypanther]]></dc:creator>
				<category><![CDATA[兴趣杂项]]></category>
		<category><![CDATA[服务器管理]]></category>

		<guid isPermaLink="false">http://www.biofacebook.com/?p=1411</guid>
		<description><![CDATA[<p>首先使用bash &#60;(curl -L -s https://install.direct/go.sh)来快捷安装v2ray，如下：</p> root@vm:~# bash &#60;(curl -L -s https://install.direct/go.sh) Installing V2Ray v4.18.0 on x86_64 Downloading V2Ray: https://github.com/v2ray/v2ray-core/releases/download/v4.18.0/v2ray-linux-64.zip % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 608 0 608 0 0 581 0 --:--:-- 0:00:01 --:--:-- 581 100 10.5M 100 10.5M 0 0 [...]]]></description>
				<content:encoded><![CDATA[<p>首先使用<code>bash &lt;(curl -L -s https://install.direct/go.sh)</code>来快捷安装v2ray，如下：</p>
<pre><code>root@vm:~# bash &lt;(curl -L -s https://install.direct/go.sh)
Installing V2Ray v4.18.0 on x86_64
Downloading V2Ray: https://github.com/v2ray/v2ray-core/releases/download/v4.18.0/v2ray-linux-64.zip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   608    0   608    0     0    581      0 --:--:--  0:00:01 --:--:--   581
100 10.5M  100 10.5M    0     0   172k      0  0:01:02  0:01:02 --:--:--  194k
Extracting V2Ray package to /tmp/v2ray.
Archive:  /tmp/v2ray/v2ray.zip
  inflating: /tmp/v2ray/config.json  
   creating: /tmp/v2ray/doc/
  inflating: /tmp/v2ray/doc/readme.md  
  inflating: /tmp/v2ray/geoip.dat    
  inflating: /tmp/v2ray/geosite.dat  
   creating: /tmp/v2ray/systemd/
  inflating: /tmp/v2ray/systemd/v2ray.service  
   creating: /tmp/v2ray/systemv/
  inflating: /tmp/v2ray/systemv/v2ray  
  inflating: /tmp/v2ray/v2ctl        
 extracting: /tmp/v2ray/v2ctl.sig    
  inflating: /tmp/v2ray/v2ray        
 extracting: /tmp/v2ray/v2ray.sig    
  inflating: /tmp/v2ray/vpoint_socks_vmess.json  
  inflating: /tmp/v2ray/vpoint_vmess_freedom.json  
PORT:51332
UUID:7378f6a4-790a-11e9-8f9e-2a86e4085a59
Created symlink /etc/systemd/system/multi-user.target.wants/v2ray.service → /etc/systemd/system/v2ray.service.
V2Ray v4.18.0 is installed.
</code></pre>
<p>然后编辑<code>/etc/v2ray/config.json</code>文件，如下设置：</p>
<pre><code>{
  "inbounds": [{
    "port": 10808,  // SOCKS 代理端口，在浏览器中需配置代理并指向这个端口
    "listen": "127.0.0.1",
    "protocol": "socks",
    "settings": {
      "udp": true
    }
  }],
  "outbounds": [{
    "protocol": "vmess",
    "settings": {
      "vnext": [{
        "address": "server", // 服务器地址，请修改为你自己的服务器 ip 或域名
        "port": 10086,  // 服务器端口
        "users": [{ "id": "b831381d-6324-4d53-ad4f-8cda48b30811" }]
      }]
    }
  },{
    "protocol": "freedom",
    "tag": "direct",
    "settings": {}
  }],
  "routing": {
    "domainStrategy": "IPOnDemand",
    "rules": [{
      "type": "field",
      "ip": ["geoip:private"],
      "outboundTag": "direct"
    }]
  }
}
</code></pre>
<p>编辑完成后保存，重新启动v2ray</p>
<pre><code>root@vm:~# service v2ray stop
root@vm:~# service v2ray start
root@vm:~# service v2ray status
● v2ray.service - V2Ray Service
   Loaded: loaded (/etc/systemd/system/v2ray.service; enabled; vendor preset: en
   Active: active (running) since Sat 2019-05-18 08:58:43 CST; 5s ago
 Main PID: 8025 (v2ray)
    Tasks: 7 (limit: 2311)
   CGroup: /system.slice/v2ray.service
           └─8025 /usr/bin/v2ray/v2ray -config /etc/v2ray/config.json

5月 18 08:58:43 vm systemd[1]: Started V2Ray Service.
5月 18 08:58:43 vm v2ray[8025]: V2Ray 4.18.0 (Po) 20190228
5月 18 08:58:43 vm v2ray[8025]: A unified platform for anti-censorship.
5月 18 08:58:44 vm v2ray[8025]: 2019/05/18 08:58:44 [Warning] v2ray.com/core: V2
</code></pre>
<p>然后Firefox设置代理如下：</p>
<p>设置-常规-网络设置 勾选<strong>手动代理配置</strong>，在<strong>SOCKS主机</strong>中填入<code>127.0.0.1</code>本地IP和<strong>端口</strong>，协议勾选<strong>SOCKS_v5</strong> 建议勾选<strong>使用SOCKSv5时代理DNS</strong></p>
<p><img src="https://unixetc.com/imgs/3178501606.webp" alt="20190518090412.webp" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.biofacebook.com/?feed=rss2&#038;p=1411</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>端口绑定  将服务器IP 与本机接口连接</title>
		<link>http://www.biofacebook.com/?p=1387</link>
		<comments>http://www.biofacebook.com/?p=1387#comments</comments>
		<pubDate>Wed, 24 Jul 2019 08:26:14 +0000</pubDate>
		<dc:creator><![CDATA[szypanther]]></dc:creator>
				<category><![CDATA[服务器管理]]></category>

		<guid isPermaLink="false">http://www.biofacebook.com/?p=1387</guid>
		<description><![CDATA[<p>(base) zyshen@wyq-P310:~$ ssh -NfL localhost:8082:localhost:8082 zyshen@10.10.1.64</p> <p>端口绑定 将服务器IP 与本机接口连接 就可以浏览服务器上的网页了</p> ]]></description>
				<content:encoded><![CDATA[<p>(base) zyshen@wyq-P310:~$ ssh -NfL localhost:8082:localhost:8082 zyshen@10.10.1.64</p>
<p>端口绑定  将服务器IP 与本机接口连接 就可以浏览服务器上的网页了</p>
]]></content:encoded>
			<wfw:commentRss>http://www.biofacebook.com/?feed=rss2&#038;p=1387</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>安装ssr代理客户端 linux</title>
		<link>http://www.biofacebook.com/?p=1380</link>
		<comments>http://www.biofacebook.com/?p=1380#comments</comments>
		<pubDate>Thu, 11 Jul 2019 01:08:16 +0000</pubDate>
		<dc:creator><![CDATA[szypanther]]></dc:creator>
				<category><![CDATA[服务器管理]]></category>

		<guid isPermaLink="false">http://www.biofacebook.com/?p=1380</guid>
		<description><![CDATA[<p>安装electron-ssr</p> <p>下载地址https://github.com/erguotou520/electron-ssr/releases，选择dep格式。双击安装。</p> 在启动器中启动electorn-ssr，选择自动下载ssr 编辑服务器 <p>编辑服务器地址、混淆方式等。</p> <p>ssr://MTI3LjAuMC4xOjgzODg6YXV0aF9jaGFpbl9hOmNoYWNoYTIwLWlldGY6cGxhaW46TUEvPw (二维码自动识别)</p> 设置系统代理 <p>以上手动和自动选择一个即可，（这一步不设置，貌似也没问题，进行下一步设置就好了）。</p> 安装配置switchyomega <p>现在代理已经生效了，上面的链接可以点开了，安装好以后，在chrome右上角找到它，右键选项进入配置。</p> <p>情景模式选proxy，代理服务器地址127.0.0.1端口1080，下面的统统同默认，记得一定要点应用选项！</p> <p>6、操作完成</p> [...]]]></description>
				<content:encoded><![CDATA[<p>安装electron-ssr</p>
<p>下载地址<a class=" external" href="https://link.zhihu.com/?target=https%3A//github.com/erguotou520/electron-ssr/releases" target="_blank" rel="nofollow noreferrer" data-za-detail-view-id="1043"><span class="invisible">https://</span><span class="visible">github.com/erguotou520/</span><span class="invisible">electron-ssr/releases</span></a>，选择dep格式。双击安装。</p>
<ol>
<li>在启动器中启动electorn-ssr，选择自动下载ssr</li>
</ol>
<figure data-size="normal"><img class="origin_image zh-lightbox-thumb lazy" src="https://pic3.zhimg.com/80/v2-955918ff224a5bc09e58fa63f3687116_hd.jpg" alt="" width="1159" data-caption="" data-size="normal" data-rawwidth="1159" data-rawheight="400" data-original="https://pic3.zhimg.com/v2-955918ff224a5bc09e58fa63f3687116_r.jpg" data-actualsrc="https://pic3.zhimg.com/v2-955918ff224a5bc09e58fa63f3687116_b.jpg" /></figure>
<figure data-size="normal"><img class="origin_image zh-lightbox-thumb lazy" src="https://pic3.zhimg.com/80/v2-fbd42e53c59d46d6168b0d69b43ca7e2_hd.jpg" alt="" width="804" data-caption="" data-size="normal" data-rawwidth="804" data-rawheight="477" data-original="https://pic3.zhimg.com/v2-fbd42e53c59d46d6168b0d69b43ca7e2_r.jpg" data-actualsrc="https://pic3.zhimg.com/v2-fbd42e53c59d46d6168b0d69b43ca7e2_b.jpg" /></figure>
<ol>
<li>编辑服务器</li>
</ol>
<figure data-size="normal"><img class="origin_image zh-lightbox-thumb lazy" src="https://pic3.zhimg.com/80/v2-3b27247de2f2e59863f92f27f956690e_hd.jpg" alt="" width="543" data-caption="" data-size="normal" data-rawwidth="543" data-rawheight="397" data-original="https://pic3.zhimg.com/v2-3b27247de2f2e59863f92f27f956690e_r.jpg" data-actualsrc="https://pic3.zhimg.com/v2-3b27247de2f2e59863f92f27f956690e_b.jpg" /></figure>
<p>编辑服务器地址、混淆方式等。</p>
<p>ssr://MTI3LjAuMC4xOjgzODg6YXV0aF9jaGFpbl9hOmNoYWNoYTIwLWlldGY6cGxhaW46TUEvPw (二维码自动识别)</p>
<ol>
<li>设置系统代理</li>
</ol>
<figure data-size="normal"><img class="content_image lazy" src="https://pic2.zhimg.com/80/v2-fb56ea8ff74d0771797e8013b4fdce7d_hd.jpg" alt="" width="405" data-caption="" data-size="normal" data-rawwidth="405" data-rawheight="515" data-actualsrc="https://pic2.zhimg.com/v2-fb56ea8ff74d0771797e8013b4fdce7d_b.jpg" /></figure>
<figure data-size="normal"><img class="content_image lazy" src="https://pic4.zhimg.com/80/v2-6e3cdfb9c2ec49298e521a3048ea4907_hd.jpg" alt="" width="405" data-caption="" data-size="normal" data-rawwidth="405" data-rawheight="704" data-actualsrc="https://pic4.zhimg.com/v2-6e3cdfb9c2ec49298e521a3048ea4907_b.jpg" /></figure>
<figure data-size="normal"><img class="content_image lazy" src="https://pic3.zhimg.com/80/v2-360803b675f6c38d24a87ff8e6a405c6_hd.jpg" alt="" width="411" data-caption="" data-size="normal" data-rawwidth="411" data-rawheight="528" data-actualsrc="https://pic3.zhimg.com/v2-360803b675f6c38d24a87ff8e6a405c6_b.jpg" /></figure>
<p>以上手动和自动选择一个即可，（这一步不设置，貌似也没问题，进行下一步设置就好了）。</p>
<h2>安装配置<b>switchyomega</b></h2>
<p>现在代理已经生效了，上面的链接可以点开了，安装好以后，在chrome右上角找到它，右键选项进入配置。</p>
<p>情景模式选proxy，代理服务器地址127.0.0.1端口1080，下面的统统同默认，记得一定要点应用选项！</p>
<figure data-size="normal"><img class="origin_image zh-lightbox-thumb lazy" src="https://pic1.zhimg.com/80/v2-78eb4c742fe8555344142bf80eb29660_hd.jpg" alt="" width="879" data-caption="" data-size="normal" data-rawwidth="879" data-rawheight="391" data-original="https://pic1.zhimg.com/v2-78eb4c742fe8555344142bf80eb29660_r.jpg" data-actualsrc="https://pic1.zhimg.com/v2-78eb4c742fe8555344142bf80eb29660_b.jpg" /></figure>
<p>6、操作完成</p>
]]></content:encoded>
			<wfw:commentRss>http://www.biofacebook.com/?feed=rss2&#038;p=1380</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python多版本pip安装库的问题(转）</title>
		<link>http://www.biofacebook.com/?p=1351</link>
		<comments>http://www.biofacebook.com/?p=1351#comments</comments>
		<pubDate>Thu, 24 Jan 2019 03:05:57 +0000</pubDate>
		<dc:creator><![CDATA[szypanther]]></dc:creator>
				<category><![CDATA[服务器管理]]></category>

		<guid isPermaLink="false">http://www.biofacebook.com/?p=1351</guid>
		<description><![CDATA[<p>机器上总是会有Python2.7的版本和Python3.x的版本，今天接触到一台服务器上面有Python2.7和Python3.4，想在Python3.4下安装一个TensorFlow，但不管怎么装都只能装到Python2.7上，特别头疼，后来发现是因为不论用pip还是pip3，都是指向的Python2.7。</p> <p>查看pip指向</p> <p>按照这篇博客中说的方法，检查了一遍pip和pip3分别指向的Python：</p> <p>$ pip -V</p> <p>$ pip3 -V 1 2 3 发现居然都指向了Python2.7：</p> <p>怪不得怎么装都是装到了Python2.7环境下。</p> <p>所以我们的问题变成了怎么通过pip去指定安装到Python3.x下。 怪不得怎么装都是装到了Python2.7环境下。</p> <p>所以我们的问题变成了怎么通过pip去指定安装到Python3.x下。</p> <p>解决方案</p> <p>更改pip3指向 一种方法是更改pip与pip3其中一个的指向，一般pip指向Python2.7，pip3指向Python3.x。这种方法可以一劳永逸地让之后的pip3安装都顺利一点，方法参考这篇博客。我并没有用这种方法，所以也没实测。</p> <p>强制安装到Python3.x环境下 如果我们直接用命令“pip3 install &#60;库名&#62;”，那么是默认安装到pip3指向的Python环境的，但是我们也可以强制安装到Python3.x：</p> <p>$ sudo python3 -m pip install tensorflow-gpu &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; 作者：Cloudox_ 来源：CSDN 原文：https://blog.csdn.net/Cloudox_/article/details/78616378 版权声明：本文为博主原创文章，转载请附上博文链接！</p> ]]></description>
				<content:encoded><![CDATA[<p>机器上总是会有Python2.7的版本和Python3.x的版本，今天接触到一台服务器上面有Python2.7和Python3.4，想在Python3.4下安装一个TensorFlow，但不管怎么装都只能装到Python2.7上，特别头疼，后来发现是因为不论用pip还是pip3，都是指向的Python2.7。</p>
<p>查看pip指向</p>
<p>按照这篇博客中说的方法，检查了一遍pip和pip3分别指向的Python：</p>
<p>$ pip -V</p>
<p>$ pip3 -V<br />
1<br />
2<br />
3<br />
发现居然都指向了Python2.7：</p>
<p>怪不得怎么装都是装到了Python2.7环境下。</p>
<p>所以我们的问题变成了怎么通过pip去指定安装到Python3.x下。<br />
怪不得怎么装都是装到了Python2.7环境下。</p>
<p>所以我们的问题变成了怎么通过pip去指定安装到Python3.x下。</p>
<p>解决方案</p>
<p>更改pip3指向<br />
一种方法是更改pip与pip3其中一个的指向，一般pip指向Python2.7，pip3指向Python3.x。这种方法可以一劳永逸地让之后的pip3安装都顺利一点，方法参考这篇博客。我并没有用这种方法，所以也没实测。</p>
<p>强制安装到Python3.x环境下<br />
如果我们直接用命令“pip3 install &lt;库名&gt;”，那么是默认安装到pip3指向的Python环境的，但是我们也可以强制安装到Python3.x：</p>
<p>$ sudo python3 -m pip install tensorflow-gpu<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
作者：Cloudox_<br />
来源：CSDN<br />
原文：https://blog.csdn.net/Cloudox_/article/details/78616378<br />
版权声明：本文为博主原创文章，转载请附上博文链接！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.biofacebook.com/?feed=rss2&#038;p=1351</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cloud cmd install</title>
		<link>http://www.biofacebook.com/?p=1339</link>
		<comments>http://www.biofacebook.com/?p=1339#comments</comments>
		<pubDate>Thu, 20 Sep 2018 05:38:08 +0000</pubDate>
		<dc:creator><![CDATA[szypanther]]></dc:creator>
				<category><![CDATA[服务器管理]]></category>

		<guid isPermaLink="false">http://www.biofacebook.com/?p=1339</guid>
		<description><![CDATA[<p>&#160;</p> <p>&#160;</p> <p>&#160;</p> Install <p>The installation of file manager is very simple.</p> install latest version of node.js. install cloudcmd via npm with: npm i cloudcmd -g <p>When in trouble use:</p> npm i cloudcmd -g --force <p>sudo vi /usr/lib/node_modules/cloudcmd/json/config.json</p> <p>&#8220;dirStorage&#8221;: false, &#8220;online&#8221;: true, &#8220;open&#8221;: false, &#8220;keysPanel&#8221;: true, &#8220;port&#8221;: 8080, &#8220;ip&#8221;: &#8220;143.89.31.17&#8221;, &#8220;root&#8221;: &#8220;/&#8221;, &#8220;prefix&#8221;: &#8220;&#8221;, &#8220;progress&#8221;: [...]]]></description>
				<content:encoded><![CDATA[<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h2 id="install">Install</h2>
<p>The installation of file manager is very simple.</p>
<ul>
<li>install latest version of <a title="node.js" href="https://nodejs.org/">node.js</a>.</li>
<li>install <code class="highlighter-rouge">cloudcmd</code> via <code class="highlighter-rouge">npm</code> with:</li>
</ul>
<div class="language-sh highlighter-rouge">
<div class="highlight">
<pre class="highlight"><code>npm i cloudcmd <span class="nt">-g</span>
</code></pre>
</div>
</div>
<p>When in trouble use:</p>
<div class="language-sh highlighter-rouge">
<div class="highlight">
<pre class="highlight"><code>npm i cloudcmd <span class="nt">-g</span> <span class="nt">--force

</span></code></pre>
<p>sudo vi /usr/lib/node_modules/cloudcmd/json/config.json</p>
<p>&#8220;dirStorage&#8221;: false,<br />
&#8220;online&#8221;: true,<br />
&#8220;open&#8221;: false,<br />
&#8220;keysPanel&#8221;: true,<br />
&#8220;port&#8221;: 8080,<br />
&#8220;ip&#8221;: &#8220;143.89.31.17&#8221;,<br />
&#8220;root&#8221;: &#8220;/&#8221;,<br />
&#8220;prefix&#8221;: &#8220;&#8221;,<br />
&#8220;progress&#8221;: true,<br />
&#8220;contact&#8221;: true,<br />
&#8220;confirmCopy&#8221;: true,<br />
&#8220;confirmMove&#8221;: true,<br />
&#8220;configDialog&#8221;: true,<br />
&#8220;oneFilePanel&#8221;: false,<br />
&#8220;console&#8221;: true,<br />
&#8220;syncConsolePath&#8221;: false,<br />
&#8220;terminal&#8221;: false,<br />
&#8220;terminalPath&#8221;: &#8220;&#8221;,<br />
&#8220;showConfig&#8221;: false,<br />
&#8220;showFileName&#8221;: false,<br />
&#8220;vim&#8221;: false,<br />
&#8220;columns&#8221;: &#8220;name-size-date-owner-mode&#8221;,<br />
&#8220;export&#8221;: false,<br />
&#8220;exportToken&#8221;: &#8220;root&#8221;,<br />
&#8220;import&#8221;:false,<br />
&#8220;importToken&#8221;: &#8220;root&#8221;,<br />
&#8220;importUrl&#8221;: &#8220;http://143.89.31.17:8080&#8243;,<br />
&#8220;importListen&#8221;: false,<br />
&#8220;log&#8221;: true</p>
<pre class="highlight">
open 8080 port to let access 143.89.31.17:8080</pre>
</div>
</div>
<p>993 systemctl start firewalld<br />
994 systemctl status firewalld<br />
995 firewall-cmd &#8211;permanent &#8211;add-port=8080/tcp<br />
996 sudo firewall-cmd &#8211;permanent &#8211;add-port=8080/tcp<br />
997 firewall-cmd &#8211;reload<br />
998 sudo firewall-cmd &#8211;reload<br />
999 sudo vi /usr/lib/node_modules/cloudcmd/json/config.json</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.biofacebook.com/?feed=rss2&#038;p=1339</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VOSEQ server start</title>
		<link>http://www.biofacebook.com/?p=1314</link>
		<comments>http://www.biofacebook.com/?p=1314#comments</comments>
		<pubDate>Thu, 12 Jul 2018 03:24:28 +0000</pubDate>
		<dc:creator><![CDATA[szypanther]]></dc:creator>
				<category><![CDATA[兴趣杂项]]></category>
		<category><![CDATA[服务器管理]]></category>

		<guid isPermaLink="false">http://www.biofacebook.com/?p=1314</guid>
		<description><![CDATA[ #### <p>[shenzy@LFE0530 VoSeq-2.1.1]$ source /usr/bin/virtualenvwrapper.sh [shenzy@LFE0530 VoSeq-2.1.1]$ workon voseq_environment (voseq_environment) [shenzy@LFE0530 VoSeq-2.1.1]$</p> <p>python voseq/manage.py runserver &#8211;settings=voseq.settings.local 143.89.29.80:8000</p> <p>&#160;</p> setup environmental variables, virtual environments Wai-Yin Kwan edited this page on Jul 5, 2015 · 12 revisions Pages 7 Home Common git commands Computer setup Github workflow Helpful links misc commands setup environmental variables, virtual environments [...]]]></description>
				<content:encoded><![CDATA[<div class="gh-header">
<div class="gh-header-show">
<h1 class="gh-header-title instapaper_title">####</h1>
<p>[shenzy@LFE0530 VoSeq-2.1.1]$ source /usr/bin/virtualenvwrapper.sh<br />
[shenzy@LFE0530 VoSeq-2.1.1]$ workon voseq_environment<br />
(voseq_environment) [shenzy@LFE0530 VoSeq-2.1.1]$</p>
<p>python voseq/manage.py runserver &#8211;settings=voseq.settings.local 143.89.29.80:8000</p>
<p>&nbsp;</p>
<h1 class="gh-header-title instapaper_title">setup environmental variables, virtual environments</h1>
<div class="gh-header-meta">Wai-Yin Kwan edited this page on Jul 5, 2015 · <a class="history" href="https://github.com/LearnTeachCode/marsrocks/wiki/setup-environmental-variables,--virtual-environments/_history">12 revisions</a></div>
</div>
</div>
<div id="wiki-content" class="wiki-content">
<div class="has-rightbar">
<div id="wiki-rightbar" class="wiki-rightbar">
<div class="wiki-pages-box readability-sidebar boxed-group flush js-wiki-pages-box ">
<h3 class="js-wiki-toggle-collapse wiki-auxiliary-content">Pages <span class="Counter">7</span></h3>
<div class="boxed-group-inner wiki-auxiliary-content wiki-auxiliary-content-no-bg">
<ul class="wiki-pages" data-filterable-for="wiki-pages-filter" data-filterable-type="substring">
<li><strong><a class="wiki-page-link" href="https://github.com/LearnTeachCode/marsrocks/wiki">Home</a></strong></li>
<li><strong><a class="wiki-page-link" href="https://github.com/LearnTeachCode/marsrocks/wiki/Common-git-commands">Common git commands</a></strong></li>
<li><strong><a class="wiki-page-link" href="https://github.com/LearnTeachCode/marsrocks/wiki/Computer-setup">Computer setup</a></strong></li>
<li><strong><a class="wiki-page-link" href="https://github.com/LearnTeachCode/marsrocks/wiki/Github-workflow">Github workflow</a></strong></li>
<li><strong><a class="wiki-page-link" href="https://github.com/LearnTeachCode/marsrocks/wiki/Helpful-links">Helpful links</a></strong></li>
<li><strong><a class="wiki-page-link" href="https://github.com/LearnTeachCode/marsrocks/wiki/misc-commands">misc commands</a></strong></li>
<li><strong><a class="wiki-page-link" href="https://github.com/LearnTeachCode/marsrocks/wiki/setup-environmental-variables,--virtual-environments">setup environmental variables, virtual environments</a></strong></li>
</ul>
</div>
</div>
<h5 class="mt-0 mb-2">Clone this wiki locally</h5>
<div class="width-full input-group"><input id="wiki-clone-url" class="form-control input-sm text-small text-gray input-monospace js-url-field" readonly="readonly" type="text" value="https://github.com/LearnTeachCode/marsrocks.wiki.git" /></div>
</div>
<div id="wiki-body" class="wiki-body gollum-markdown-content instapaper_body">
<div class="markdown-body">
<p>When developing and deploying a web app, different environments (local machine, live site) need different configurations (passwords, database names, etc). We can use environmental variables to setup the different environments. Here are two options to set up environmental variables: easy way with autoenv or harder way with virtualenvwrapper.</p>
<p>You need to use a text editor to edit these files. In this demo, I&#8217;m using atom, but you can use any text editor.</p>
<h2><a id="user-content-easy-way-using-autoenv" class="anchor" href="https://github.com/LearnTeachCode/marsrocks/wiki/setup-environmental-variables,--virtual-environments#easy-way-using-autoenv"></a>Easy way using autoenv</h2>
<h4><a id="user-content-part-1-only-do-this-once" class="anchor" href="https://github.com/LearnTeachCode/marsrocks/wiki/setup-environmental-variables,--virtual-environments#part-1-only-do-this-once"></a>Part 1. Only do this once.</h4>
<ol>
<li>Download <a href="https://github.com/kennethreitz/autoenv">autoenv</a>.</li>
</ol>
<pre><code>$ git clone git://github.com/kennethreitz/autoenv.git ~/.autoenv

$ echo 'source ~/.autoenv/activate.sh' &gt;&gt; ~/.bashrc
</code></pre>
<h4><a id="user-content-part-2-do-this-for-every-project" class="anchor" href="https://github.com/LearnTeachCode/marsrocks/wiki/setup-environmental-variables,--virtual-environments#part-2-do-this-for-every-project"></a>Part 2. Do this for every project.</h4>
<ol>
<li>create .env file in the root directory of the project.</li>
</ol>
<pre><code>$ cd &lt;path/to/project&gt;

$ touch .env
</code></pre>
<p>open the .env file.</p>
<pre><code>$ atom .env
</code></pre>
<p>Put environmental variables into the .env file, then save the file.</p>
<pre><code>export VARIABLE_NAME="value"

</code></pre>
<ol start="2">
<li>reload shell</li>
</ol>
<pre><code> source ~/.bashrc
</code></pre>
<ol start="3">
<li>type <code>y</code> when you will see a message like:</li>
</ol>
<pre><code>autoenv: This is the first time you are about to source /path/.env:

autoenv: Are you sure you want to allow this? (y/N)</code></pre>
</div>
</div>
</div>
</div>
<p>##########################################</p>
<pre><code class="language-text" data-lang="text">sudo pip install virtualenvwrapper
</code></pre>
<pre><code class="language-text" data-lang="text">export WORKON_HOME=~/venvs</code></pre>
<pre><code class="language-text" data-lang="text">source /usr/bin/virtualenvwrapper.sh
</code></pre>
<pre>mkvirtualenv -p /usr/bin/python3 voseq_environment

[shenzy@LFE0530 VoSeq]$ mkvirtualenv -p /usr/bin/python3 voseq_environment
Running virtualenv with interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/shenzy/envs/voseq_environment/bin/python3
Also creating executable in /home/shenzy/envs/voseq_environment/bin/python
Installing setuptools, pip, wheel...done.
virtualenvwrapper.user_scripts creating /home/shenzy/envs/voseq_environment/bin/predeactivate
virtualenvwrapper.user_scripts creating /home/shenzy/envs/voseq_environment/bin/postdeactivate
virtualenvwrapper.user_scripts creating /home/shenzy/envs/voseq_environment/bin/preactivate
virtualenvwrapper.user_scripts creating /home/shenzy/envs/voseq_environment/bin/postactivate
virtualenvwrapper.user_scripts creating /home/shenzy/envs/voseq_environment/bin/get_env_details
(voseq_environment) [shenzy@LFE0530 VoSeq]$ workon voseq_environment</pre>
<p><strong>pip install django</strong></p>
<pre>pip install django-suit</pre>
<pre class="default prettyprint prettyprinted"><code><span class="pln">pip install </span><span class="pun">-</span><span class="pln">r requirements</span><span class="pun">.</span><span class="pln">txt</span></code></pre>
<pre><code class="language-text" data-lang="text">#########################33</code></pre>
<p>cd /home/shenzy/software/VoSeq</p>
<p>workon voseq_environment</p>
<p>source ~/.autoenv/activate.sh      #  使得能够调用 blastn 等 通过  export path</p>
<p><strong>pip install django</strong></p>
<p>pip install django-suit</p>
<pre class="default prettyprint prettyprinted"><code><span class="pln">pip install </span><span class="pun">-</span><span class="pln">r requirements</span><span class="pun">.</span><span class="pln">txt</span></code></pre>
<p>make serve</p>
<p>(voseq_environment) [shenzy@LFE0530 VoSeq]$ make serve<br />
python voseq/manage.py create_stats &#8211;settings=voseq.settings.local<br />
python voseq/manage.py runserver &#8211;settings=voseq.settings.local<br />
Performing system checks&#8230;</p>
<p>System check identified no issues (0 silenced).<br />
July 16, 2018 &#8211; 06:10:13<br />
Django version 1.10.4, using settings &#8216;voseq.settings.local&#8217;<br />
Starting development server at http://127.0.0.1:8000/<br />
Quit the server with CONTROL-C.</p>
<p>&nbsp;</p>
<p>(voseq_environment) [shenzy@LFE0530 VoSeq]$ make serve<br />
python voseq/manage.py create_stats &#8211;settings=voseq.settings.local<br />
python voseq/manage.py runserver &#8211;settings=voseq.settings.local<br />
Performing system checks&#8230;</p>
<p>System check identified no issues (0 silenced).<br />
July 16, 2018 &#8211; 07:02:22<br />
Django version 1.10.4, using settings &#8216;voseq.settings.local&#8217;<br />
Starting development server at http://127.0.0.1:8000/<br />
Quit the server with CONTROL-C.<br />
^C<br />
(voseq_environment) [shenzy@LFE0530 VoSeq]$ vi setup.py<br />
(voseq_environment) [shenzy@LFE0530 VoSeq]$ vi runserver.py<br />
(voseq_environment) [shenzy@LFE0530 VoSeq]$ python voseq/manage.py runserver &#8211;settings=voseq.settings.local 143.89.29.80:8000<br />
Performing system checks&#8230;</p>
<p>System check identified no issues (0 silenced).<br />
July 16, 2018 &#8211; 07:03:30<br />
Django version 1.10.4, using settings &#8216;voseq.settings.local&#8217;<br />
Starting development server at http://143.89.29.80:8000/</p>
<p>&nbsp;</p>
<p>########################</p>
<p>[shenzy@LFE0530 VoSeq]$ sudo -u postgres -i<br />
[postgres@LFE0530 ~]$ psql<br />
psql (9.2.23)<br />
Type &#8220;help&#8221; for help.</p>
<p>postgres=#</p>
<p>sudo -u postgres -i</p>
<p>&nbsp;</p>
<div class="votecell post-layout--left">
<div class="vote">
<h1 class="grid--cell fs-headline1 fl1"><a class="question-hyperlink" href="https://stackoverflow.com/questions/26846093/postgresql-9-3-on-centos-7-with-custom-pgdata">Postgresql 9.3 on Centos 7 with custom PGDATA</a></h1>
</div>
</div>
<div class="answercell post-layout--right">
<div class="post-text">
<p>920 sudo yum install postgresql postgresql-contrib postgresql-server-dev-9.3<br />
922 sudo yum uninstall postgresql<br />
923 sudo yum remove postgresql<br />
924 sudo yum install postgresql<br />
925 sudo yum install postgresql*<br />
927 sudo yum reinstall postgresql*<br />
931 sudo -u postgres createuser owning_user<br />
932 sudo -u postgres createuser shenzy<br />
933 sudo -u postgres createuser postgres<br />
935 sudo -u postgres -i<br />
945 sudo -u postgres -i</p>
<p>&nbsp;</p>
<p>try this:</p>
<pre class="lang-sql prettyprint prettyprinted"><code> <span class="pun">##</span><span class="pln"> Login </span><span class="kwd">with</span><span class="pln"> postgres </span><span class="kwd">user 
</span><span class="pln">sudo -u postgres -i</span><span class="pln">
 export PGDATA</span><span class="pun">=/</span><span class="pln">your_path</span><span class="pun">/</span><span class="pln">data
 pg_ctl </span><span class="pun">-</span><span class="pln">D </span><span class="pun">$</span><span class="pln">PGDATA </span><span class="kwd">start</span> <span class="pun">&amp;</span></code></pre>
</div>
</div>
<p>&nbsp;</p>
<pre class="lang-sql prettyprint prettyprinted"><code><span class="pln">service postgresql </span><span class="kwd">start/status</span></code></pre>
<p>SHOW data_directory;</p>
<p>postgres=# \q<br />
[postgres@LFE0530 ~]$ pwd<br />
/var/lib/pgsql<br />
[postgres@LFE0530 ~]$ psql<br />
psql (9.2.23)<br />
Type &#8220;help&#8221; for help.</p>
<p>postgres=# SHOW data_directory;<br />
data_directory<br />
&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
/home/pgsql<br />
(1 row)</p>
<p>&nbsp;</p>
<p>虽然还是显示下面错误，但其实上面的已经可以让 pgsql启动，并服务！！！</p>
<p>Redirecting to /bin/systemctl status postgresql.service<br />
● postgresql.service &#8211; PostgreSQL database server<br />
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled)<br />
Active: failed (Result: exit-code) since 三 2018-07-18 22:31:30 EDT; 5min ago<br />
Process: 8035 ExecStart=/usr/bin/pg_ctl start -D ${PGDATA} -s -o -p ${PGPORT} -w -t 300 (code=exited, status=1/FAILURE)<br />
Process: 8029 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)</p>
<p>7月 18 22:31:29 LFE0530 pg_ctl[8035]: HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.<br />
7月 18 22:31:29 LFE0530 pg_ctl[8035]: LOG: could not bind IPv4 socket: Address already in use<br />
7月 18 22:31:29 LFE0530 pg_ctl[8035]: HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.<br />
7月 18 22:31:29 LFE0530 pg_ctl[8035]: WARNING: could not create listen socket for &#8220;localhost&#8221;<br />
7月 18 22:31:29 LFE0530 pg_ctl[8035]: FATAL: could not create any TCP/IP sockets<br />
7月 18 22:31:30 LFE0530 pg_ctl[8035]: pg_ctl: could not start server<br />
7月 18 22:31:30 LFE0530 systemd[1]: postgresql.service: control process exited, code=exited status=1<br />
7月 18 22:31:30 LFE0530 systemd[1]: Failed to start PostgreSQL database server.<br />
7月 18 22:31:30 LFE0530 systemd[1]: Unit postgresql.service entered failed state.<br />
7月 18 22:31:30 LFE0530 systemd[1]: postgresql.service failed.<br />
[root@LFE0530 data]#</p>
<p>&nbsp;</p>
<p>voseq=# \COPY public_interface_vouchers(code,notes) FROM &#8216;/home/shenzy/software/VoSeq/U-RVDBv13.0.voucher_10_5000top.csv&#8217; DELIMITER &#8216;,&#8217; CSV HEADER;<br />
voseq=#</p>
<p>voseq=#<br />
\COPY public_interface_sequences FROM &#8216;/home/shenzy/software/VoSeq/all.gene_fasta_10test_import.csv&#8217; DELIMITER &#8216;,&#8217; CSV;<br />
voseq=#<br />
\COPY public_interface_sequences FROM &#8216;/home/shenzy/software/VoSeq/all.gene_fasta_10test_import.csv&#8217; DELIMITER &#8216;,&#8217; CSV;<br />
voseq=#<br />
\COPY public_interface_vouchers FROM &#8216;/home/shenzy/software/VoSeq/U-RVDBv13.0.voucher_import.csv&#8217; DELIMITER &#8216;,&#8217; CSV;</p>
<p>&nbsp;</p>
<p>###########################<br />
export</p>
<p>voseq=# COPY public_interface_sequences TO &#8216;/home/shenzy/software/VoSeq/testseq.csv&#8217; WITH CSV;</p>
<p>&nbsp;</p>
<p>############33</p>
<p>#empty table<br />
voseq=# truncate table public_interface_sequences  CASCADE;<br />
NOTICE:  truncate cascades to table &#8220;public_interface_primers&#8221;<br />
TRUNCATE TABLE<br />
voseq=# truncate table public_interface_vouchers CASCADE;<br />
NOTICE:  truncate cascades to table &#8220;public_interface_flickrimages&#8221;<br />
NOTICE:  truncate cascades to table &#8220;public_interface_localimages&#8221;<br />
NOTICE:  truncate cascades to table &#8220;public_interface_sequences&#8221;<br />
NOTICE:  truncate cascades to table &#8220;public_interface_primers&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.biofacebook.com/?feed=rss2&#038;p=1314</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python Subprocess returns non-zero exit status only in cron</title>
		<link>http://www.biofacebook.com/?p=1283</link>
		<comments>http://www.biofacebook.com/?p=1283#comments</comments>
		<pubDate>Tue, 25 Jul 2017 12:12:29 +0000</pubDate>
		<dc:creator><![CDATA[szypanther]]></dc:creator>
				<category><![CDATA[Linux相关]]></category>
		<category><![CDATA[服务器管理]]></category>

		<guid isPermaLink="false">http://www.biofacebook.com/?p=1283</guid>
		<description><![CDATA[ <p>You should try to capture stderr in addition to stdout so that you can find out exactly why the program is failing (assuming it does indeed print some errors for you)</p> cmd = ['/path/to/casperjs', '/path/to/doSomething.js', 'args'] response = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) 0 ok 126 权限，拷贝一份，并赋予该用户所有的权限 [...]]]></description>
				<content:encoded><![CDATA[<table>
<tbody>
<tr>
<td class="votecell"></td>
<td class="answercell">
<div class="post-text">
<p>You should try to capture stderr in addition to stdout so that you can find out exactly why the program is failing (assuming it does indeed print some errors for you)</p>
</div>
</td>
</tr>
</tbody>
</table>
<pre class="lang-py prettyprint prettyprinted"><code><span class="pln">
cmd </span><span class="pun">=</span> <span class="pun">[</span><span class="str">'/path/to/casperjs'</span><span class="pun">,</span> <span class="str">'/path/to/doSomething.js'</span><span class="pun">,</span> <span class="str">'args'</span><span class="pun">]</span><span class="pln">
response </span><span class="pun">=</span><span class="pln"> subprocess</span><span class="pun">.</span><span class="pln">check_output</span><span class="pun">(</span><span class="pln">cmd</span><span class="pun">,</span><span class="pln"> 
                shell</span><span class="pun">=</span><span class="kwd">True</span><span class="pun">,</span><span class="pln">
                stderr</span><span class="pun">=</span><span class="pln">subprocess</span><span class="pun">.</span><span class="pln">STDOUT</span><span class="pun">)

0 ok    126 权限，拷贝一份，并赋予该用户所有的权限</span></code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.biofacebook.com/?feed=rss2&#038;p=1283</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>linux iptables导致httpd网页打不开（转帖）</title>
		<link>http://www.biofacebook.com/?p=1256</link>
		<comments>http://www.biofacebook.com/?p=1256#comments</comments>
		<pubDate>Sat, 25 Mar 2017 03:42:38 +0000</pubDate>
		<dc:creator><![CDATA[szypanther]]></dc:creator>
				<category><![CDATA[Linux相关]]></category>
		<category><![CDATA[服务器管理]]></category>

		<guid isPermaLink="false">http://www.biofacebook.com/?p=1256</guid>
		<description><![CDATA[ linux iptables导致httpd网页打不开 原创作品，允许转载，转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://taotao1240.blog.51cto.com/731446/611758 <p> 问题：httpd 服务已启动，80端口已开，但是网页就是打不开，重启服务器还是不行</p> <p>忽然想看看log，记录如下：</p> <p>[Fri Jul 15 00:41:03 2011] [notice] SELinux policy enabled; httpd running as context root:system_r:httpd_t:s0</p> <p>[Fri Jul 15 00:41:03 2011] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)</p> <p>[Fri Jul 15 00:41:03 2011] [notice] Digest: generating secret for digest authentication &#8230;</p> <p>[Fri Jul 15 00:41:03 2011] [notice] Digest: [...]]]></description>
				<content:encoded><![CDATA[<div class="showHead">
<div class="showTitleBOx">
<div class="artTime">linux iptables导致httpd网页打不开</div>
</div>
</div>
<div class="CopyrightStatement lh22">原创作品，允许转载，转载时请务必以超链接形式标明文章 <a href="http://taotao1240.blog.51cto.com/731446/611758" target="_blank">原始出处</a> 、作者信息和本声明。否则将追究法律责任。<a href="http://taotao1240.blog.51cto.com/731446/611758">http://taotao1240.blog.51cto.com/731446/611758</a></div>
<div class="showContent">
<p>  问题：httpd 服务已启动，80端口已开，但是网页就是打不开，重启服务器还是不行</p>
<p>忽然想看看log，记录如下：</p>
<p>[Fri Jul 15 00:41:03 2011] [notice] SELinux policy enabled; httpd running as context root:system_r:httpd_t:s0</p>
<p>[Fri Jul 15 00:41:03 2011] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)</p>
<p>[Fri Jul 15 00:41:03 2011] [notice] Digest: generating secret for digest authentication &#8230;</p>
<p>[Fri Jul 15 00:41:03 2011] [notice] Digest: done</p>
<p>[Fri Jul 15 00:41:03 2011] [notice] Apache/2.2.3 (CentOS) configured &#8212; resuming normal operations</p>
<p>看到 suexec，明白了，果断iptables -L ,结果如下：</p>
<p>ACCEPT     all  &#8212;  anywhere             anywhere</p>
<p>ACCEPT     icmp &#8212;  anywhere             anywhere            icmp any</p>
<p>ACCEPT     esp  &#8212;  anywhere             anywhere</p>
<p>ACCEPT     ah   &#8212;  anywhere             anywhere</p>
<p>ACCEPT     udp  &#8212;  anywhere             224.0.0.251         udp dpt:mdns</p>
<p>ACCEPT     udp  &#8212;  anywhere             anywhere            udp dpt:ipp</p>
<p>ACCEPT     tcp  &#8212;  anywhere             anywhere            tcp dpt:ipp</p>
<p>ACCEPT     all  &#8212;  anywhere             anywhere            state RELATED,ESTABLISHED</p>
<p>ACCEPT     tcp  &#8212;  anywhere             anywhere            state NEW tcp dpt:ssh</p>
<p>REJECT     all  &#8212;  anywhere             anywhere            reject-with icmp-host-prohibited</p>
<p>&nbsp;</p>
<p>全部干掉，iptables -F ，再打开网页，显示正常</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.biofacebook.com/?feed=rss2&#038;p=1256</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ubuntu下搭建vpn历程(转贴）</title>
		<link>http://www.biofacebook.com/?p=1244</link>
		<comments>http://www.biofacebook.com/?p=1244#comments</comments>
		<pubDate>Thu, 12 Jan 2017 06:38:05 +0000</pubDate>
		<dc:creator><![CDATA[szypanther]]></dc:creator>
				<category><![CDATA[Linux相关]]></category>
		<category><![CDATA[服务器管理]]></category>

		<guid isPermaLink="false">http://www.biofacebook.com/?p=1244</guid>
		<description><![CDATA[1、卸载pptpd和iptables，重新安装pptpd #卸载pptpd $ apt-get autoremove pptpd $ apt-get purge pptpd #卸载iptables $ apt-get autoremove iptables* $ apt-get purge iptables* #安装pptpd $ apt-get install pptpd 2、配置pptpd （1）首先，编辑pptpd.conf文件，设置localip和remoteip $ vim /etc/pptpd.conf <p>查找到localip和remoteip，打开注释进行设置。将localip设置为你的vps的服务器公网ip，不知道可以通过ifconfig查看。remoteip是设置给VPN用户分配的IP段，我这里设置为10.100.0.2-100。</p> localip VPS_IP remoteip 10.100.0.2-100 （2）修改dns设置，设置为google的DNS $ vim /etc/ppp/pptpd-options <p>查找到ms-dns，配置dns如下：</p> ms-dns 8.8.8.8 ms-dns 8.8.4.4 （3）设置VPN的账号密码 <p>编辑chap-secrets文件</p> $ vim /etc/ppp/chap-secrets <p>在chap-secrets文件中添加一行配置</p> #client server secret IP address liuchungui [...]]]></description>
				<content:encoded><![CDATA[<h2 id="1、卸载pptpd和iptables，重新安装pptpd">1、卸载pptpd和iptables，重新安装pptpd</h2>
<figure class="highlight plain">
<table>
<tbody>
<tr>
<td class="code">
<div class="line">#卸载pptpd</div>
<div class="line">$ apt-get autoremove pptpd</div>
<div class="line">$ apt-get purge pptpd</div>
<div class="line"></div>
<div class="line">#卸载iptables</div>
<div class="line">$ apt-get autoremove iptables*</div>
<div class="line">$ apt-get purge iptables*</div>
<div class="line"></div>
<div class="line">#安装pptpd</div>
<div class="line">$ apt-get install pptpd</div>
</td>
</tr>
</tbody>
</table>
</figure>
<h2 id="2、配置pptpd">2、配置pptpd</h2>
<h4 id="（1）首先，编辑pptpd-conf文件，设置localip和remoteip">（1）首先，编辑pptpd.conf文件，设置localip和remoteip</h4>
<figure class="highlight plain">
<table>
<tbody>
<tr>
<td class="code">
<div class="line">$ vim /etc/pptpd.conf</div>
</td>
</tr>
</tbody>
</table>
</figure>
<p>查找到localip和remoteip，打开注释进行设置。将localip设置为你的vps的服务器公网ip，不知道可以通过ifconfig查看。remoteip是设置给VPN用户分配的IP段，我这里设置为10.100.0.2-100。</p>
<figure class="highlight plain">
<table>
<tbody>
<tr>
<td class="code">
<div class="line">localip VPS_IP</div>
<div class="line">remoteip 10.100.0.2-100</div>
</td>
</tr>
</tbody>
</table>
</figure>
<h4 id="（2）修改dns设置，设置为google的DNS">（2）修改dns设置，设置为google的DNS</h4>
<figure class="highlight plain">
<table>
<tbody>
<tr>
<td class="code">
<div class="line">$ vim /etc/ppp/pptpd-options</div>
</td>
</tr>
</tbody>
</table>
</figure>
<p>查找到ms-dns，配置dns如下：</p>
<figure class="highlight plain">
<table>
<tbody>
<tr>
<td class="code">
<div class="line">ms-dns 8.8.8.8</div>
<div class="line">ms-dns 8.8.4.4</div>
</td>
</tr>
</tbody>
</table>
</figure>
<h4 id="（3）设置VPN的账号密码">（3）设置VPN的账号密码</h4>
<p>编辑chap-secrets文件</p>
<figure class="highlight plain">
<table>
<tbody>
<tr>
<td class="code">
<div class="line">$ vim /etc/ppp/chap-secrets</div>
</td>
</tr>
</tbody>
</table>
</figure>
<p>在chap-secrets文件中添加一行配置</p>
<figure class="highlight plain">
<table>
<tbody>
<tr>
<td class="code">
<div class="line">#client server secret IP address</div>
<div class="line">liuchungui pptpd 123456 *</div>
</td>
</tr>
</tbody>
</table>
</figure>
<p>其中，liuchungui是VPN的用户名，使用的VPN服务类型是pptpd，密码是123456，*代表不限制IP</p>
<h2 id="3、启动pptpd服务">3、启动pptpd服务</h2>
<figure class="highlight plain">
<table>
<tbody>
<tr>
<td class="code">
<div class="line">$ /etc/init.d/pptpd restart</div>
</td>
</tr>
</tbody>
</table>
</figure>
<p>输入上面命令，如果提示`</p>
<ul>
<li>Restarting PoPToP Point to Point Tunneling Server pptpd [ OK ] `<br />
就说明启动成功了</li>
</ul>
<h2 id="4、设置系统的ipv4的转发开关">4、设置系统的ipv4的转发开关</h2>
<figure class="highlight plain">
<table>
<tbody>
<tr>
<td class="code">
<div class="line">$ vim /etc/sysctl.conf</div>
</td>
</tr>
</tbody>
</table>
</figure>
<p>编辑<code>/etc/sysctl.conf</code>文件，找到<code>net.ipv4.ip_forward=1</code>，把这行的注释打开并保存。<br />
运行：<code>sysctl -p</code> 让上面的修改立即生效。</p>
<h2 id="5、配置iptables">5、配置iptables</h2>
<h4 id="（1）安装iptables">（1）安装iptables</h4>
<figure class="highlight plain">
<table>
<tbody>
<tr>
<td class="code">
<div class="line">$ apt-get install iptables</div>
</td>
</tr>
</tbody>
</table>
</figure>
<h4 id="（2）添加一个NAT，这里特别注意：eth1是vps的ip网卡接口，可以通过ifconfig查看">（2）添加一个NAT，这里特别注意：<code>eth1</code>是vps的ip网卡接口，可以通过ifconfig查看</h4>
<figure class="highlight plain">
<table>
<tbody>
<tr>
<td class="code">
<div class="line">$ iptables -t nat -A POSTROUTING -s 10.100.0.0/24 -o eth1 -j MASQUERADE</div>
</td>
</tr>
</tbody>
</table>
</figure>
<h4 id="（3）设置MTU，防止包过大">（3）设置MTU，防止包过大</h4>
<figure class="highlight plain">
<table>
<tbody>
<tr>
<td class="code">
<div class="line">$ iptables -A FORWARD -s 10.100.0.0/24 -p tcp -m tcp &#8211;tcp-flags SYN,RST SYN -j TCPMSS &#8211;set-mss 1200</div>
</td>
</tr>
</tbody>
</table>
</figure>
<h4 id="（4）再添加一个NAT，45-62-119-172就是你的vps的公网ip">（4）再添加一个NAT，<code>45.62.119.172</code>就是你的vps的公网ip</h4>
<figure class="highlight plain">
<table>
<tbody>
<tr>
<td class="code">
<div class="line">$ iptables -t nat -A POSTROUTING -s 10.100.0.0/24 -j SNAT &#8211;to-source 45.62.119.172</div>
</td>
</tr>
</tbody>
</table>
</figure>
<h4 id="（5）将iptables规则保存，令重启后规则不丢失：">（5）将iptables规则保存，令重启后规则不丢失：</h4>
<figure class="highlight plain">
<table>
<tbody>
<tr>
<td class="code">
<div class="line">$ iptables-save &gt; /etc/iptables-rules</div>
</td>
</tr>
</tbody>
</table>
</figure>
<h4 id="（6）编辑网卡文件，加载网卡时自动加载规则">（6）编辑网卡文件，加载网卡时自动加载规则</h4>
<figure class="highlight plain">
<table>
<tbody>
<tr>
<td class="code">
<div class="line">$ vim /etc/network/interfaces</div>
</td>
</tr>
</tbody>
</table>
</figure>
<p>在<code>interfaces</code>文件末尾加上：<code>pre-up iptables-restore &lt; /etc/iptables-rules</code></p>
<h4 id="（7）安装iptables配置持久化">（7）安装iptables配置持久化</h4>
<figure class="highlight plain">
<table>
<tbody>
<tr>
<td class="code">
<div class="line">$ apt-get install iptables-persistent</div>
</td>
</tr>
</tbody>
</table>
</figure>
<h4 id="（8）运行保存配置命令">（8）运行保存配置命令</h4>
<figure class="highlight plain">
<table>
<tbody>
<tr>
<td class="code">
<div class="line">$ service iptables-persistent start</div>
</td>
</tr>
</tbody>
</table>
</figure>
]]></content:encoded>
			<wfw:commentRss>http://www.biofacebook.com/?feed=rss2&#038;p=1244</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
