Questions in category: Xubuntu (Xubuntu)
软件 >> Xubuntu

1. Xubuntu 下配置网络连接

Posted by haifeng on 2018-11-12 22:09:07 last update 2018-11-12 22:55:14 | Answers (0) | 收藏


Step 1. 首先运行 ifconfig 命令,

haifeng@X220i:~\$ ifconfig
enp0s25   Link encap:以太网  硬件地址 xx:xx:xx:xx:xx:xx
          UP BROADCAST MULTICAST  MTU:1500  跃点数:1
          接收数据包:0 错误:0 丢弃:0 过载:0 帧数:0
          发送数据包:0 错误:0 丢弃:0 过载:0 载波:0
          碰撞:0 发送队列长度:1000
          接收字节:0 (0.0 B)  发送字节:0 (0.0 B)
          中断:20 Memory:f2500000-f2520000

lo        Link encap:本地环回  
          inet 地址:127.0.0.1  掩码:255.0.0.0
          inet6 地址: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  跃点数:1
          接收数据包:22901 错误:0 丢弃:0 过载:0 帧数:0
          发送数据包:22901 错误:0 丢弃:0 过载:0 载波:0
          碰撞:0 发送队列长度:1000
          接收字节:2718229 (2.7 MB)  发送字节:2718229 (2.7 MB)

wlp3s0    Link encap:以太网  硬件地址 xx:xx:xx:xx:xx:xx  
          inet 地址:10.0.0.9  广播:10.0.0.255  掩码:255.255.255.0
          inet6 地址: fe80::9012:467c:1ab7:8f64/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  跃点数:1
          接收数据包:3072 错误:0 丢弃:0 过载:0 帧数:0
          发送数据包:10145 错误:0 丢弃:0 过载:0 载波:0
          碰撞:0 发送队列长度:1000
          接收字节:216777 (216.7 KB)  发送字节:1016088 (1.0 MB)



Step 2.  编辑 /etc/network/ 目录下的 interfaces 文件

haifeng@X220i:/etc/network\$ ls
if-down.d  if-post-down.d  if-pre-up.d  if-up.d  interfaces  interfaces.d
haifeng@X220i:/etc/network\$ sudo vim interfaces

内容为:

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto wlp3s0
iface wlp3s0 inet dhcp

auto enp0s25
iface enp0s25 inet dhcp
~                                                                               
~


Step 3.  启动有线设备enp0s25 和无线设备 wlp3s0


haifeng@X220i:/etc/network\$ sudo ifup wlp3s0

haifeng@X220i:/etc/network\$ sudo ifup enp0s25
Internet Systems Consortium DHCP Client 4.3.3
Copyright 2004-2015 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/enp0s25/xx:xx:xx:xx:xx:xx
Sending on   LPF/enp0s25/xx:xx:xx:xx:xx:xx
Sending on   Socket/fallback
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 3 (xid=0xfad07973)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 8 (xid=0xfad07973)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 12 (xid=0xfad07973)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 18 (xid=0xfad07973)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 12 (xid=0xfad07973)
DHCPREQUEST of 10.0.0.9 on enp0s25 to 255.255.255.255 port 67 (xid=0x7379d0fa)
DHCPOFFER of 10.0.0.9 from 10.0.0.1
DHCPACK of 10.0.0.9 from 10.0.0.1
bound to 10.0.0.9 -- renewal in 42655 seconds.


Step 4. 更改 /etc/resolv.conf 文件, 使用 Google 的公共 DNS (Domain Name System 域名系统)

haifeng@X220i:/etc\$ ls -l resolv.conf
lrwxrwxrwx 1 root root 29 10月  8  2017 resolv.conf -> ../run/resolvconf/resolv.conf

我们可以新建一个 resolv.conf, 内容为

nameserver 114.114.114.114
nameserver 8.8.8.8

重新启动 networking
haifeng@X220i:/etc\$ sudo /etc/init.d/networking restart
[ ok ] Restarting networking (via systemctl): networking.service.

 

2. Xubuntu 16.04 LTS 下安装搜狗输入法

Posted by haifeng on 2017-10-10 09:05:48 last update 2017-10-10 09:13:17 | Answers (0) | 收藏


Note: 以下内容完全拷贝自 http://hitwanghong.com/2017/04/19/xubuntu-sogo-pinyin.html

 

一、安装搜狗拼音输入法

1. 添加fcitx的PPA

代码如下:

sudo add-apt-repository ppa:fcitx-team/nightly
2. 刷新软件源, 安装依赖软件

刷新软件源代码如下:

sudo apt-get update

刷新完成之后, 安装im-config:

sudo apt-get install im-config

继续安装搜狗输入法依赖的fcitx一系列文件, 命令如下:

sudo apt-get -f install
3. 下载并安装搜狗输入法
  • 到搜狗官网下载搜狗拼音输入法, 选择系统对应的软件包下载.
  • 下载完成后, 进入安装包文件所在目录, 用如下命令进行安装:
sudo dpkg -i sogoupinyin_2.1.0086_amd64.deb

注意:文件名根据下载的安装包而定, 可使用Tab键自动补全.

  • 安装完成后, 使用如下命令启用搜狗输入法, 完成之后重启系统, 即可点击输入汉字.
sudo im-config -s fcitx -z default

二、卸载搜狗拼音输入法

1. 首先使用如下命令查看安装的搜狗拼音输入法
sudo dpkg -l so*

然后先卸载搜狗拼音输入法:

sudo apt-get purge sogoupinyin
2. 卸载fcitx
sudo apt-get purge fcitx
3. 彻底卸载fcitx及其相关配置
sudo apt-get autoremove
4. 最后注销或者重启系统, 如果注销按钮不能使用, 可以使用命令
sudo pkill Xorg

再次登录系统, 可以看到搜狗输入法已经被卸载干净.


 

实验过程

haifeng@X220i:~$ sudo add-apt-repository ppa:fcitx-team/nightly
 Experimental releases of Fcitx, use with caution.
 更多信息: https://launchpad.net/~fcitx-team/+archive/ubuntu/nightly
按回车继续或者 Ctrl+c 取消添加

gpg: 钥匙环‘/tmp/tmpwgspxj4q/secring.gpg’已建立
gpg: 钥匙环‘/tmp/tmpwgspxj4q/pubring.gpg’已建立
gpg: 下载密钥‘7E5FA1EE’,从 hkp 服务器 keyserver.ubuntu.com
gpg: /tmp/tmpwgspxj4q/trustdb.gpg:建立了信任度数据库
gpg: 密钥 7E5FA1EE:公钥“Launchpad PPA for Fcitx Team PPA”已导入
gpg: 合计被处理的数量:1
gpg:               已导入:1  (RSA: 1)
OK
haifeng@X220i:~$

haifeng@X220i:~$ sudo apt-get update
命中:1 http://cn.archive.ubuntu.com/ubuntu xenial InRelease
命中:2 http://cn.archive.ubuntu.com/ubuntu xenial-updates InRelease            
命中:3 http://cn.archive.ubuntu.com/ubuntu xenial-backports InRelease          
获取:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]    
忽略:5 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial InRelease
命中:6 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu xenial InRelease
忽略:7 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial Release
忽略:8 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main amd64 Packages
忽略:9 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main i386 Packages
忽略:10 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main all Packages
忽略:11 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main Translation-zh_CN
忽略:12 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main Translation-zh
忽略:13 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main Translation-en
忽略:14 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main amd64 DEP-11 Metadata
忽略:15 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main DEP-11 64x64 Icons
忽略:8 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main amd64 Packages
忽略:9 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main i386 Packages
忽略:10 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main all Packages
忽略:11 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main Translation-zh_CN
忽略:12 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main Translation-zh
忽略:13 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main Translation-en
忽略:14 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main amd64 DEP-11 Metadata
忽略:15 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main DEP-11 64x64 Icons
忽略:8 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main amd64 Packages
忽略:9 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main i386 Packages
忽略:10 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main all Packages
忽略:11 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main Translation-zh_CN
忽略:12 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main Translation-zh
忽略:13 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main Translation-en
忽略:14 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main amd64 DEP-11 Metadata
忽略:15 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main DEP-11 64x64 Icons
忽略:8 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main amd64 Packages
忽略:9 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main i386 Packages
忽略:10 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main all Packages
忽略:11 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main Translation-zh_CN
忽略:12 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main Translation-zh
忽略:13 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main Translation-en
忽略:14 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main amd64 DEP-11 Metadata
忽略:15 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main DEP-11 64x64 Icons
忽略:8 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main amd64 Packages
忽略:9 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main i386 Packages
忽略:10 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main all Packages
忽略:11 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main Translation-zh_CN
忽略:12 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main Translation-zh
忽略:13 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main Translation-en
忽略:14 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main amd64 DEP-11 Metadata
忽略:15 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main DEP-11 64x64 Icons
错误:8 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main amd64 Packages
  404  Not Found
忽略:9 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main i386 Packages
忽略:10 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main all Packages
忽略:11 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main Translation-zh_CN
忽略:12 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main Translation-zh
忽略:13 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main Translation-en
忽略:14 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main amd64 DEP-11 Metadata
忽略:15 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial/main DEP-11 64x64 Icons
已下载 102 kB,耗时 40秒 (2,494 B/s)
正在读取软件包列表... 完成
W: 仓库 “http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial Release” 没有 Release 文件。
N: 无法认证来自该源的数据,所以使用它会带来潜在风险。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
E: 无法下载 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu/dists/xenial/main/binary-amd64/Packages  404  Not Found
E: 部分索引文件下载失败。如果忽略它们,那将转而使用旧的索引文件。

 


References:

http://hitwanghong.com/2017/04/19/xubuntu-sogo-pinyin.html

https://fcitx-im.org/wiki/Install_(Ubuntu)

3. 如何在Xubuntu中添加PPA (Personal Package Archives)

Posted by haifeng on 2017-10-10 08:48:12 last update 2017-10-10 09:23:33 | Answers (0) | 收藏


 

sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt-get update

 

haifeng@X220i:~$ sudo add-apt-repository ppa:ubuntugis/ppa
[sudo] haifeng 的密码:
 Official stable UbuntuGIS packages.


 更多信息: https://launchpad.net/~ubuntugis/+archive/ubuntu/ppa
按回车继续或者 Ctrl+c 取消添加

gpg: 钥匙环‘/tmp/tmpncw1rcwr/secring.gpg’已建立
gpg: 钥匙环‘/tmp/tmpncw1rcwr/pubring.gpg’已建立
gpg: 下载密钥‘314DF160’,从 hkp 服务器 keyserver.ubuntu.com
gpg: /tmp/tmpncw1rcwr/trustdb.gpg:建立了信任度数据库
gpg: 密钥 314DF160:公钥“Launchpad ubuntugis-stable”已导入
gpg: 合计被处理的数量:1
gpg:               已导入:1  (RSA: 1)
OK
haifeng@X220i:~$

haifeng@X220i:~$ sudo apt-get update

命中:1 http://cn.archive.ubuntu.com/ubuntu xenial InRelease
命中:2 http://cn.archive.ubuntu.com/ubuntu xenial-updates InRelease            
命中:3 http://cn.archive.ubuntu.com/ubuntu xenial-backports InRelease          
获取:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]    
获取:5 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu xenial InRelease [23.8 kB]
获取:6 http://security.ubuntu.com/ubuntu xenial-security/main amd64 DEP-11 Metadata [60.2 kB]
获取:7 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu xenial/main amd64 Packages [42.9 kB]
获取:8 http://security.ubuntu.com/ubuntu xenial-security/main DEP-11 64x64 Icons [57.6 kB]
获取:9 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 DEP-11 Metadata [49.2 kB]
获取:10 http://security.ubuntu.com/ubuntu xenial-security/universe DEP-11 64x64 Icons [69.8 kB]
获取:11 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu xenial/main i386 Packages [43.0 kB]
获取:12 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu xenial/main Translation-en [17.4 kB]
已下载 466 kB,耗时 9秒 (48.5 kB/s)                                            
正在读取软件包列表... 完成
haifeng@X220i:~$

haifeng@X220i:/etc/apt/sources.list.d$ ls
fcitx-team-ubuntu-nightly-xenial.list  ubuntugis-ubuntu-ppa-xenial.list.save
ubuntugis-ubuntu-ppa-xenial.list

 


References:

https://launchpad.net/~ubuntugis/+archive/ubuntu/ppa

 


如何删除PPA

sudo add-apt-repository --remove ppa:PPA_Name/ppa

 

实验过程

haifeng@X220i:~$ sudo add-apt-repository --remove ppa:fcitx-team/nightly
 Experimental releases of Fcitx, use with caution.
 更多信息: https://launchpad.net/~fcitx-team/+archive/ubuntu/nightly
按 [ENTER] 可继续操作,按 ctrl-c 可取消其删除操作

haifeng@X220i:~$

 

References:

https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/

 


4. Xubuntu 16.04 下安装 FastDFS

Posted by haifeng on 2017-10-08 23:00:19 last update 2017-10-10 14:33:43 | Answers (0) | 收藏


首先仔细阅读 FastDFS 的 README.md 和 INSTALL 文件。为方便起见,文末列出了INSTALL文件中的内容。

 

大致安装步骤如下:

Step 1.

./make.sh

其实这一步就出现了错误:没有 logger.h 这个文件

haifeng@X220i:~/work/cs/git/github/fastdfs$ ./make.sh
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o ../common/fdfs_global.o ../common/fdfs_global.c  -I../common -I/usr/include/fastcommon
../common/fdfs_global.c:20:20: fatal error: logger.h: 没有那个文件或目录
compilation terminated.

 

解决办法:

在安装 FastDFS 之前,需要安装 libfastcommon

cd ~/work/cs/git/github

git clone https://github.com/happyfish100/libfastcommon.git

vim README
vim INSTALL

#step 3. make
./make.sh

#step 4. make install
sudo ./make.sh install

安装结束后,再回到 FastDFS, 执行 Step 1   ./make.sh  顺利编译。

 

Step 2.

sudo ./make.sh install

 

安装结束,检查一下

haifeng@X220i:/usr/bin$ ls fdfs*
fdfs_appender_test   fdfs_delete_file    fdfs_storaged  fdfs_upload_appender
fdfs_appender_test1  fdfs_download_file  fdfs_test      fdfs_upload_file
fdfs_append_file     fdfs_file_info      fdfs_test1
fdfs_crc32           fdfs_monitor        fdfs_trackerd

 

配置文件位于 /etc/fdfs/ , 不过现在还不能用, 因为都是以 .sample 结尾的。有四个文件: client.conf.sample   storage_ids.conf.sample
storage.conf.sample  tracker.conf.sample . 我们依次将它们拷贝为 client.conf  storage_ids.conf  storage.conf  tracker.conf

haifeng@X220i:/etc/fdfs$ ls -l
总用量 24
-rw-r--r-- 1 root root 1461 10月  8 23:27 client.conf.sample
-rw-r--r-- 1 root root 7927 10月  8 23:27 storage.conf.sample
-rw-r--r-- 1 root root  105 10月  8 23:27 storage_ids.conf.sample
-rw-r--r-- 1 root root 7389 10月  8 23:27 tracker.conf.sample
haifeng@X220i:/etc/fdfs$ sudo cp client.conf.sample client.conf
[sudo] haifeng 的密码:

haifeng@X220i:/etc/fdfs$ sudo cp storage.conf.sample storage.conf
haifeng@X220i:/etc/fdfs$ sudo cp storage_ids.conf.sample storage_ids.conf
haifeng@X220i:/etc/fdfs$ sudo cp tracker.conf.sample tracker.conf

修改 tracter.conf, 将其中的 base_path 改为自己的路径, 比如改为/home/haifeng/fastdfs

# the base path to store data and log files
#base_path=/home/yuqing/fastdfs
base_path=/home/haifeng/fastdfs

 

 

 


最后还需要与 Nginx 整合在一起,需要安装 fastdfs-nginx-module

 


Reference:

http://www.cnblogs.com/fish-king/archive/2013/03/14/2960441.html

 

 


 

Copy right 2009 Happy Fish / YuQing

FastDFS may be copied only under the terms of the GNU General
Public License V3, which may be found in the FastDFS source kit.
Please visit the FastDFS Home Page for more detail.
English language: http://english.csource.org/
Chinese language: http://www.csource.org/

#step 1. download libfastcommon source package from github and install it,
   the github address:
   https://github.com/happyfish100/libfastcommon.git

#step 2. download FastDFS source package and unpack it,
tar xzf FastDFS_v5.x.tar.gz
#for example:
tar xzf FastDFS_v5.08.tar.gz

#step 3. enter the FastDFS dir
cd FastDFS

#step 4. execute:
./make.sh

#step 5. make install
./make.sh install

#step 6. edit/modify the config file of tracker and storage

#step 7. run server programs
#start the tracker server:
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
#in Linux, you can start fdfs_trackerd as a service:
/sbin/service fdfs_trackerd start

#start the storage server:
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart
#in Linux, you can start fdfs_storaged as a service:
/sbin/service fdfs_storaged start

#step 8. run test program
#run the client test program:
/usr/bin/fdfs_test
/usr/bin/fdfs_test1
#for example, upload a file:
/usr/bin/fdfs_test conf/client.conf upload /usr/include/stdlib.h

#step 9. run monitor program
#run the monitor program:
/usr/bin/fdfs_monitor


tracker server config file sample please see conf/tracker.conf

storage server config file sample please see conf/storage.conf

client config file sample please see conf/client.conf


Item detail
1. server common items
---------------------------------------------------
|  item name            |  type  | default | Must |
---------------------------------------------------
| base_path             | string |         |  Y   |
---------------------------------------------------
| disabled              | boolean| false   |  N   |
---------------------------------------------------
| bind_addr             | string |         |  N   |
---------------------------------------------------
| network_timeout       | int    | 30(s)   |  N   |
---------------------------------------------------
| max_connections       | int    | 256     |  N   |
---------------------------------------------------
| log_level             | string | info    |  N   |
---------------------------------------------------
| run_by_group          | string |         |  N   |
---------------------------------------------------
| run_by_user           | string |         |  N   |
---------------------------------------------------
| allow_hosts           | string |   *     |  N   |
---------------------------------------------------
| sync_log_buff_interval| int    |  10(s)  |  N   |
---------------------------------------------------
| thread_stack_size     | string |  1M     |  N   |
---------------------------------------------------
memo:
   * base_path is the base path of sub dirs:
     data and logs. base_path must exist and it's sub dirs will
     be automatically created if not exist.
       $base_path/data: store data files
       $base_path/logs: store log files
   * log_level is the standard log level as syslog, case insensitive
     # emerg: for emergency
     # alert
     # crit: for critical
     # error
     # warn: for warning
     # notice
     # info
     # debug
   * allow_hosts can ocur more than once, host can be hostname or ip address,
     "*" means match all ip addresses, can use range like this: 10.0.1.[1-15,20]
      or host[01-08,20-25].domain.com, for example:
        allow_hosts=10.0.1.[1-15,20]
        allow_hosts=host[01-08,20-25].domain.com

2. tracker server items
---------------------------------------------------
|  item name            |  type  | default | Must |
---------------------------------------------------
| port                  | int    | 22000   |  N   |
---------------------------------------------------
| store_lookup          | int    |  0      |  N   |
---------------------------------------------------
| store_group           | string |         |  N   |
---------------------------------------------------
| store_server          | int    |  0      |  N   |
---------------------------------------------------
| store_path            | int    |  0      |  N   |
---------------------------------------------------
| download_server       | int    |  0      |  N   |
---------------------------------------------------
| reserved_storage_space| string |  1GB    |  N   |
---------------------------------------------------

memo:
  * the value of store_lookup is:
    0: round robin (default)
    1: specify group
    2: load balance (supported since V1.1)
  * store_group is the name of group to store files.
    when store_lookup set to 1(specify group),
    store_group must be set to a specified group name.
  * reserved_storage_space is the reserved storage space for system
    or other applications. if the free(available) space of any stoarge
    server in a group <= reserved_storage_space, no file can be uploaded
    to this group (since V1.1)
    bytes unit can be one of follows:
      # G or g for gigabyte(GB)
      # M or m for megabyte(MB)
      # K or k for kilobyte(KB)
      # no unit for byte(B)

3. storage server items
-------------------------------------------------
|  item name          |  type  | default | Must |
-------------------------------------------------
| group_name          | string |         |  Y   |
-------------------------------------------------
| tracker_server      | string |         |  Y   |
-------------------------------------------------
| port                | int    | 23000   |  N   |
-------------------------------------------------
| heart_beat_interval | int    |  30(s)  |  N   |
-------------------------------------------------
| stat_report_interval| int    | 300(s)  |  N   |
-------------------------------------------------
| sync_wait_msec      | int    | 100(ms) |  N   |
-------------------------------------------------
| sync_interval       | int    |   0(ms) |  N   |
-------------------------------------------------
| sync_start_time     | string |  00:00  |  N   |
-------------------------------------------------
| sync_end_time       | string |  23:59  |  N   |
-------------------------------------------------
| store_path_count    | int    |   1     |  N   |
-------------------------------------------------
| store_path0         | string |base_path|  N   |
-------------------------------------------------
| store_path#         | string |         |  N   |
-------------------------------------------------
|subdir_count_per_path| int    |   256   |  N   |
-------------------------------------------------
|check_file_duplicate | boolean|    0    |  N   |
-------------------------------------------------
| key_namespace       | string |         |  N   |
-------------------------------------------------
| keep_alive          | boolean|    0    |  N   |
-------------------------------------------------
| sync_binlog_buff_interval| int |   60s |  N   |
-------------------------------------------------

memo:
  * tracker_server can ocur more than once, and tracker_server format is
    "host:port", host can be hostname or ip address.
  * store_path#, # for digital, based 0
  * check_file_duplicate: when set to true, must work with FastDHT server,
    more detail please see INSTALL of FastDHT. FastDHT download page:
    http://code.google.com/p/fastdht/downloads/list
  * key_namespace: FastDHT key namespace, can't be empty when
    check_file_duplicate is true. the key namespace should short as possible
 

 

5. Xubuntu 16.04 LTS 下安装 libevent

Posted by haifeng on 2017-10-08 22:33:22 last update 2017-10-08 23:45:04 | Answers (0) | 收藏


在运行下面的 autogen.sh 之前,需要安装 autoconf , 参见问题2016

haifeng@X220i:~/work/cs/git/github/libevent$ ./autogen.sh

这将生成 configure 文件

然后就是通常的

./configure
make
make verify   # (optional)
sudo make install

 

 


关于 Libevent, 可以参考

http://www.cnblogs.com/lexus/archive/2011/11/11/2245323.html

 

6. Xubuntu 16.04 LTS 安装 autoconf

Posted by haifeng on 2017-10-08 22:26:10 last update 2017-10-08 22:27:25 | Answers (0) | 收藏


haifeng@X220i:~/work/cs/git/github/libevent$ sudo apt-get install autoconf
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
将会同时安装下列软件:
  automake autotools-dev m4
建议安装:
  autoconf-archive gnu-standards autoconf-doc libtool
下列【新】软件包将被安装:
  autoconf automake autotools-dev m4
升级了 0 个软件包,新安装了 4 个软件包,要卸载 0 个软件包,有 114 个软件包未被升级。
需要下载 1,065 kB 的归档。
解压缩后会消耗 3,935 kB 的额外空间。
您希望继续执行吗? [Y/n]y

 

sudo apt-get install autoconf-archive gnu-standards autoconf-doc libtool

 

7. Xubuntu 16.04 LTS 下安装截图软件

Posted by haifeng on 2017-10-08 21:47:05 last update 2017-10-08 22:40:29 | Answers (0) | 收藏


haifeng@X220i:~/work/cs/git/github$ sudo apt-get install scrot
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
将会同时安装下列软件:
  giblib1 libgif7 libid3tag0 libimlib2
下列【新】软件包将被安装:
  giblib1 libgif7 libid3tag0 libimlib2 scrot
升级了 0 个软件包,新安装了 5 个软件包,要卸载 0 个软件包,有 133 个软件包未被升级。
需要下载 266 kB 的归档。
解压缩后会消耗 904 kB 的额外空间。
您希望继续执行吗? [Y/n] y


 

更好的一个软件是 shutter, 注意这里需要额外安装好多软件包,包括了重要的build-essentia 等等

 

haifeng@X220i:~/work/cs/git/github$ sudo apt-get install shutter
[sudo] haifeng 的密码:
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
将会同时安装下列软件:
  build-essential cpp-5 dpkg-dev fakeroot g++ g++-5 gcc-5 gcc-5-base
  gtk2-engines-pixbuf libalgorithm-diff-perl libalgorithm-diff-xs-perl
  libalgorithm-merge-perl libappindicator1 libasan2 libatomic1 libbonobo2-0
  libbonobo2-common libbonoboui2-0 libbonoboui2-common libcc1-0 libcilkrts5
  libclass-data-inheritable-perl libclass-method-modifiers-perl
  libcommon-sense-perl libcrypt-openssl-bignum-perl libcrypt-openssl-rsa-perl
  libdata-random-perl libextutils-depends-perl libextutils-pkgconfig-perl
  libfakeroot libfile-which-perl libgail18 libgcc-5-dev libgd-perl libglade2-0
  libgnome-2-0 libgnome2-0 libgnome2-bin libgnome2-canvas-perl
  libgnome2-common libgnome2-gconf-perl libgnome2-perl libgnome2-vfs-perl
  libgnome2-wnck-perl libgnomecanvas2-0 libgnomecanvas2-common libgnomeui-0
  libgnomeui-common libgnomevfs2-0 libgnomevfs2-common libgnomevfs2-extra
  libgomp1 libgoo-canvas-perl libgoocanvas-common libgoocanvas3
  libgtk2-appindicator-perl libgtk2-imageview-perl libgtk2-unique-perl
  libgtk2.0-0 libgtk2.0-bin libgtkimageview0 libhttp-server-simple-perl
  libimage-magick-perl libimage-magick-q16-perl libindicator7 libitm1
  libjson-perl libjson-xs-perl liblsan0 libmouse-perl libmpx0
  libnet-dropbox-api-perl libnet-oauth-perl liborbit-2-0 libpath-class-perl
  libproc-processtable-perl libproc-simple-perl libquadmath0
  libsort-naturally-perl libstdc++-5-dev libstdc++6 libtsan0
  libtypes-serialiser-perl libubsan0 libwww-mechanize-perl libxml-libxml-perl
  libxml-namespacesupport-perl libxml-sax-base-perl libxml-sax-expat-perl
  libxml-sax-perl libxml-simple-perl perlmagick pkg-config
建议安装:
  gcc-5-locales debian-keyring g++-multilib g++-5-multilib gcc-5-doc
  libstdc++6-5-dbg gcc-5-multilib libgcc1-dbg libgomp1-dbg libitm1-dbg
  libatomic1-dbg libasan2-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg
  libcilkrts5-dbg libmpx0-dbg libquadmath0-dbg libbonobo2-bin libswitch-perl
  | perl libgnomevfs2-bin gamin | fam gnome-mime-data imagemagick-doc
  libmojolicious-perl libstdc++-5-doc gnome-web-photo nautilus-sendto
  libimage-exiftool-perl libnet-dbus-glib-perl
下列【新】软件包将被安装:
  build-essential dpkg-dev fakeroot g++ g++-5 libalgorithm-diff-perl
  libalgorithm-diff-xs-perl libalgorithm-merge-perl libappindicator1
  libbonobo2-0 libbonobo2-common libbonoboui2-0 libbonoboui2-common
  libclass-data-inheritable-perl libclass-method-modifiers-perl
  libcommon-sense-perl libcrypt-openssl-bignum-perl libcrypt-openssl-rsa-perl
  libdata-random-perl libextutils-depends-perl libextutils-pkgconfig-perl
  libfakeroot libfile-which-perl libgail18 libgd-perl libglade2-0 libgnome-2-0
  libgnome2-0 libgnome2-bin libgnome2-canvas-perl libgnome2-common
  libgnome2-gconf-perl libgnome2-perl libgnome2-vfs-perl libgnome2-wnck-perl
  libgnomecanvas2-0 libgnomecanvas2-common libgnomeui-0 libgnomeui-common
  libgnomevfs2-0 libgnomevfs2-common libgnomevfs2-extra libgoo-canvas-perl
  libgoocanvas-common libgoocanvas3 libgtk2-appindicator-perl
  libgtk2-imageview-perl libgtk2-unique-perl libgtkimageview0
  libhttp-server-simple-perl libimage-magick-perl libimage-magick-q16-perl
  libindicator7 libjson-perl libjson-xs-perl libmouse-perl
  libnet-dropbox-api-perl libnet-oauth-perl liborbit-2-0 libpath-class-perl
  libproc-processtable-perl libproc-simple-perl libsort-naturally-perl
  libstdc++-5-dev libtypes-serialiser-perl libwww-mechanize-perl
  libxml-libxml-perl libxml-namespacesupport-perl libxml-sax-base-perl
  libxml-sax-expat-perl libxml-sax-perl libxml-simple-perl perlmagick
  pkg-config shutter
下列软件包将被升级:
  cpp-5 gcc-5 gcc-5-base gtk2-engines-pixbuf libasan2 libatomic1 libcc1-0
  libcilkrts5 libgcc-5-dev libgomp1 libgtk2.0-0 libgtk2.0-bin libitm1 liblsan0
  libmpx0 libquadmath0 libstdc++6 libtsan0 libubsan0
升级了 19 个软件包,新安装了 75 个软件包,要卸载 0 个软件包,有 114 个软件包未被升级。
需要下载 38.0 MB 的归档。
解压缩后会消耗 77.2 MB 的额外空间。
您希望继续执行吗? [Y/n] y

 

8. 在Xubuntu 16.04 LTS 中安装 Nginx+PHP7+PostgreSQL

Posted by haifeng on 2017-10-08 16:39:35 last update 2017-10-08 22:02:28 | Answers (0) | 收藏


Step 1. 安装Nginx

sudo apt-get install nginx

这将会同时安装下列软件:
  nginx-common nginx-core

建议安装:
  fcgiwrap nginx-doc

可以使用whereis命令查看nginx安装的位置

查看nginx的安装位置
haifeng@X220i:/etc/nginx$ whereis nginx
nginx: /usr/sbin/nginx /etc/nginx /usr/share/nginx

 

cd /etc/nginx/sites-available

sudo cp default default-original
sudo vim default

将其中的root目录改为自己设定的目录,比如

    #root /var/www/html;
    root /home/haifeng/public_html/htdocs;

 

启动 nginx

sudo /etc/init.d/nginx start

打开浏览器, 输入网址 http://localhost/  将会看到 nginx 欢迎的页面。

Welcome to nginx!

If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.

 

在安装好下面的PHP7后,继续修改 default 文件中的PHP部分,如下:

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
    
        # With php7.0-cgi alone:
        #fastcgi_pass 127.0.0.1:9000;
        # With php7.0-fpm:
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }


 

Step 2. 安装PHP7

haifeng@X220i:~$ sudo apt-get install php7.0 php7.0-fpm php7.0-mysql
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
将会同时安装下列软件:
  php-common php7.0-cli php7.0-common php7.0-json php7.0-opcache
  php7.0-readline
建议安装:
  php-pear
下列【新】软件包将被安装:
  php-common php7.0 php7.0-cli php7.0-common php7.0-fpm php7.0-json
  php7.0-mysql php7.0-opcache php7.0-readline
升级了 0 个软件包,新安装了 9 个软件包,要卸载 0 个软件包,有 133 个软件包未被升级。
需要下载 3,666 kB 的归档。
解压缩后会消耗 14.6 MB 的额外空间。
您希望继续执行吗? [Y/n] y

建议安装
php7.0-curl  php7.0-mcrypt php7.0-mbstring php7.0-xml

sudo apt-get install php7.0-curl php7.0-mcrypt php7.0-mbstring php7.0-xml

将会同时安装下列软件:
  libmcrypt4
建议安装:
  libmcrypt-dev mcrypt

最后将建议安装的软件包也安装上

sudo apt-get install php-pear libmcrypt-dev mcrypt

haifeng@X220i:~$ sudo apt-get install fcgiwrap nginx-doc
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
将会同时安装下列软件:
  libfcgi0ldbl spawn-fcgi
下列【新】软件包将被安装:
  fcgiwrap libfcgi0ldbl nginx-doc spawn-fcgi
升级了 0 个软件包,新安装了 4 个软件包,要卸载 0 个软件包,有 133 个软件包未被升级。
需要下载 210 kB 的归档。
解压缩后会消耗 728 kB 的额外空间。
您希望继续执行吗? [Y/n] y


 

Step 3. 安装PostgreSQL

haifeng@X220i:~$ sudo apt-get install postgresql
[sudo] haifeng 的密码:
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
将会同时安装下列软件:
  libpq5 postgresql-9.5 postgresql-client-9.5 postgresql-client-common
  postgresql-common postgresql-contrib-9.5 sysstat
建议安装:
  postgresql-doc locales-all postgresql-doc-9.5 libdbd-pg-perl isag
下列【新】软件包将被安装:
  libpq5 postgresql postgresql-9.5 postgresql-client-9.5
  postgresql-client-common postgresql-common postgresql-contrib-9.5 sysstat
升级了 0 个软件包,新安装了 8 个软件包,要卸载 0 个软件包,有 133 个软件包未被升级。
需要下载 4,801 kB 的归档。
解压缩后会消耗 19.4 MB 的额外空间。
您希望继续执行吗? [Y/n]

将建议的安装包也装上

sudo apt-get install postgresql-doc locales-all postgresql-doc-9.5 libdbd-pg-perl isag

haifeng@X220i:~$ sudo apt-get install postgresql-doc locales-all postgresql-doc-9.5 libdbd-pg-perl isag
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
将会同时安装下列软件:
  aglfn gnuplot-data gnuplot-tex gnuplot-x11 libdbi-perl liblua5.1-0
建议安装:
  gnuplot-doc rcs libmldbm-perl libnet-daemon-perl libsql-statement-perl
下列【新】软件包将被安装:
  aglfn gnuplot-data gnuplot-tex gnuplot-x11 isag libdbd-pg-perl libdbi-perl
  liblua5.1-0 locales-all postgresql-doc postgresql-doc-9.5
升级了 0 个软件包,新安装了 11 个软件包,要卸载 0 个软件包,有 133 个软件包未被升级。
需要下载 7,280 kB 的归档。
解压缩后会消耗 149 MB 的额外空间。
您希望继续执行吗? [Y/n] y

 

 

这里还无法安装pgadmin4, 只能安装pgadmin3

haifeng@X220i:~$ sudo apt-get install pgadmin3
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
将会同时安装下列软件:
  libwxbase3.0-0v5 libwxgtk3.0-0v5 pgadmin3-data pgagent
建议安装:
  postgresql-contrib
下列【新】软件包将被安装:
  libwxbase3.0-0v5 libwxgtk3.0-0v5 pgadmin3 pgadmin3-data pgagent
升级了 0 个软件包,新安装了 5 个软件包,要卸载 0 个软件包,有 133 个软件包未被升级。
需要下载 10.3 MB 的归档。
解压缩后会消耗 42.1 MB 的额外空间。
您希望继续执行吗? [Y/n]

 

sudo apt-get install postgresql-contrib

 

使用 which psql 和 which pgadmin3 检查一下

haifeng@X220i:~$ which pgadmin3
/usr/bin/pgadmin3

haifeng@X220i:~$ which psql
/usr/bin/psql

haifeng@X220i:~$ whereis postgresql
postgresql: /usr/lib/postgresql /etc/postgresql /usr/share/postgresql

 

启动PostgreSQL

haifeng@X220i:~$ sudo /etc/init.d/postgresql start
[ ok ] Starting postgresql (via systemctl): postgresql.service.

如果需要关闭,则执行 stop

haifeng@X220i:~$ sudo /etc/init.d/postgresql stop
[ ok ] Stopping postgresql (via systemctl): postgresql.service.

我们再次开启PostgreSQL, 然后执行下面的语句

haifeng@X220i:~$ sudo su postgres -c psql template1
psql (9.5.9)
Type "help" for help.

postgres=#

更改postgres的密码

postgres=# ALTER USER postgres WITH PASSWORD 'newpasswd';
ALTER ROLE

更新系统中用户postgres的密码

haifeng@X220i:~$ sudo passwd postgres
[sudo] haifeng 的密码:
输入新的 UNIX 密码:
重新输入新的 UNIX 密码:
passwd:已成功更新密码

 

切换到 postgres 用户

haifeng@X220i:~$ su postgres
密码:
postgres@X220i:/home/haifeng$

使用createdb命令建立一个数据库, 名称为mydb

postgres@X220i:/home/haifeng$ which createdb
/usr/bin/createdb
postgres@X220i:/home/haifeng$ createdb mydb

然后就可以连接到此数据库

postgres@X220i:/home/haifeng$ psql -U postgres -d mydb
psql (9.5.9)
Type "help" for help.

mydb=#

 

 

具体参考

http://wiki.ubuntu.com.cn/PostgreSQL