ubuntu Linux 设置记录


2017/10/18 

按照如下操作安装 Ubuntu 16.04.3 LTS 成功, win7安装ubuntu双系统

http://jingyan.baidu.com/article/76a7e409bea83efc3b6e1507.html
基本来说就是使用UltralISO制作U盘启动盘。


去https://ngrok.com/ 注册后会给你一个authtoken, 然后下载ngrok, 解压后直接运行。 


2017/10/18 

install sshd
sudo apt install openssh-server
config file is /etc/ssh/sshd_config
run cmd: service sshd restart
set sshd to start when host start: chkconfig --level 35 sshd on


2017/10/18 

install vim
sudo apt install vim

2017/10/18 

安装运行ngrok
去https://ngrok.com/ 注册后会给你一个authtoken, 然后下载ngrok, 解压后直接运行。
run cmd: ./ngrok authtoken 6SxtPPNda7fqhzfg331P_55JJvXwm4UvGp3UF6uV6T
         ./ngrok tcp 22


2017/10/18 

install screen
sudo apt install screen
2017/10/18 按照如下操作安装 Ubuntu 16.04.3 LTS 成功
http://jingyan.baidu.com/article/76a7e409bea83efc3b6e1507.html


2017/10/22

想要设定系统启动使用固定内网ip地址,更改了/etc/network/interfaces 和 /etc/resolv.conf, 然后运行了shutdown -r now命令,结果重启后发现图形界面蓝屏。

只能用Ctrl+Alt+F1 切换到命令行界面,  切换回到图形界面使用、Ctrl+Alt+F7, 依然蓝屏。


2017/10/23

首先还原了/etc/network/interfaces 文件,然后重启后又可以自动连上wifi了。 这说明是我的/etc/network/interfaces 配置导致了wifi无法连接。

重新安装ubuntu-desktop 后重启,问题成功解决。

  1. sudo apt-get install --reinstall ubuntu-desktop  
  2. sudo reboot  


2017/10/23

安装git:  sudo apt-get install git

配置用户名密码:git config --global user.name "xxx"             git config --global user.email "xxx@gmail.com",  Home目录下会自动新建一个.gitconfig文件

生成key并把公钥拷贝到github: ssh-keygen -t rsa -C "qiubing.it@gmail.com", cat ~/.ssh/id_rsa.pub,  登录github-> Settings-> SSH and GPG Keys-> New SSH key添加

测试连接是否成功: ssh -T git@github.com

2017/10/24

下载disruptor--

$ cd ~/shadows/

$ git clone https://github.com/fsaintjacques/disruptor--.git

$git clone https://github.com/real-logic/simple-binary-encoding.git


2017/10/25

安装gcc

apt-cache madison gcc 查看apt get将要安装的gcc版本号

然后安装时发现gcc已经是最新版本了 (gcc 4.8开始就支持c++11)

$ sudo apt-get install gcc
[sudo] password for qifanw:
Reading package lists... Done
Building dependency tree
Reading state information... Done
gcc is already the newest version (4:5.3.1-1ubuntu1).


安装cmake

$ sudo apt install cmake

$ cmake --version
cmake version 3.5.1


安装boost库

$ apt-cache madison libboost-dev  发现版本为1.58.0, 而boost官方网站上显示的最新版本为1.65.1, 所以决定下载源码自己手动安装最新版。

$ wget https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.gz
$ tar zxvf boost_1_65_1.tar.gz

$ cd boost_1_65_1

$ ./bootstrap.sh –with-libraries=all –with-toolset=gcc    –with-libraries指定编译哪些boost库,all的话就是全部编译, –with-toolset指定编译时使用哪种编译器

$ ./b2(或bjam) toolset=gcc  编译boost

$ ./b2 (或bjam)install  安装boost, 默认的头文件在/usr/local/include/boost目录下,库文件在/usr/local/lib/目录下
出现错误 如下:

In file included from ./boost/python/detail/prefix.hpp:13:0,
                 from ./boost/python/list.hpp:8,
                 from libs/python/src/list.cpp:5:
./boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or directory
compilation terminated.

    "g++"   -O3 -finline-functions -Wno-inline -Wall -pthread -m64  -DBOOST_ALL_NO_LIB=1 -DBOOST_PYTHON_SOURCE -DBOOST_PYTHON_STATIC_LIB -DNDEBUG  -I"." -I"/usr/include/python2.7" -c -o "bin.v2/libs/python/build/gcc-5.4.0/release/link-static/threading-multi/list.o" "libs/python/src/list.cpp"

检查了一下python已经是最新版本Python 2.7.12, 为什么会出错呢?

原来原因是没有安装对应python的python-dev依赖,这样编译到boost python模块的时候就会出错。

$ sudo apt-get install python-dev

安装python-dev之后重新运行./b2 install,还是出错如下:

cp: cannot create regular file '/usr/local/lib/libboost_python.a': Permission denied

    cp "bin.v2/libs/python/build/gcc-5.4.0/release/link-static/threading-multi/libboost_python.a"  "/usr/local/lib/libboost_python.a"

...failed common.copy /usr/local/lib/libboost_python.a...


发现是权限问题, 所以试着运行sudo ./b2 install, 问题终于解决,输出如下:

...found 39546 targets...
...updating 3 targets...
common.copy /usr/local/lib/libboost_python.a
common.copy /usr/local/lib/libboost_python.so.1.65.1
ln-UNIX /usr/local/lib/libboost_python.so
...updated 3 targets...



ln -s /usr/local/ include/boost /usr/ include/boost 在/usr/include/下生成一个boost库的include文件夹连接

$cd /usr/local
$sudo find $PWD/lib/*.* -type f -exec ln -s {} /usr/lib/ \;

 在/usr/lib/ 下生成所有boost编译出的lib库文件的对应连接
$ sudo ldconfig  刷新链接库

最后, 在使用时要注意加链接库, 例如  g++ main.cpp -g -o main -lboost_thread

使用Cmake编译disruptor--项目源代码

却出现如下错误:

CMake Warning at /usr/share/cmake-3.5/Modules/FindBoost.cmake:725 (message):
  Imported targets not available for Boost version 106501
Call Stack (most recent call first):
  /usr/share/cmake-3.5/Modules/FindBoost.cmake:763 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/share/cmake-3.5/Modules/FindBoost.cmake:1332 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:42 (find_package)

经过搜索,原因是CMAKE版本和Boost库版本不匹配导致, 如下所述(from stackoverflow):

CMake cannot detect the dependencies between the different Boost libraries. They have explicitly implemented in FindBoost.
For every Boost release this information is added by the CMake maintainers and it gets part of the next CMake release. So you have to make sure, that your CMake version was released after the Boost version you try to find.

Boost 1.63 requires CMake 3.7 or newer
Boost 1.64 requires CMake 3.8 or newer
Boost 1.65 and 1.65.1 require CMake 3.9.3 or newer

因为sudo apt-get 得到的最新的vsersion是3.5.1, 所以只能下载cmake最新源码来安装。如下:

$ wget https://cmake.org/files/v3.9/cmake-3.9.4.tar.gz

$ tar zxvf cmake-3.9.4.tar.gz

$ cd cmake-3.9.4

$ ./bootstrap

$ make 

$sudo make install

安装完成后运行cmake --version 发现有错误,并且并没有更新version

$ cmake --version
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/usr/local/share/cmake-3.5
cmake version 3.5.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

这时需要编辑~/.bashrc, 加入 一行  export  CMAKE_ROOT=/usr/local/share/cmake-3.9

然后重新source .bashrc, 就安装好了cmake。

$ cmake --version
cmake version 3.9.4

CMake suite maintained and supported by Kitware (kitware.com/cmake).


接下来继续回到disruptor--项目源代码的编译,虽然原来的CMake warnning没有了,但是继续出现如下错误:

/usr/bin/ld: CMakeFiles/claim_strategy_test_bin.dir/test/claim_strategy_test.cc.o: undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
CMakeFiles/claim_strategy_test_bin.dir/build.make:95: recipe for target 'claim_strategy_test_bin' failed

搜索发现是需要在编译时加入-pthread参数,如何让CMake在编译时加入该参数呢?只需要在CMakeLists.txt中加入如下一行:

set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread" )

这样之后disruptor--项目源代码编译顺利通过。




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值