概要:每次安装完虚拟机时,都要配置自己的环境,好多问题需要一个一个的寻找答案,浪费自己的时间,所以总结了一下留给以后参考使用
@H_502_7@
一、安装完成如需使用root身份登录,可打开终端输入以下命令:
# 设置root密码
sudo passwd root@H_502_7@
sudo -s@H_502_7@
想要在登录界面使用root身份登录,可编辑/etc/lightdm/目录下的lightdm.conf文件,如没有此文件,直接创建@H_502_7@
/usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf@H_502_7@
@H_502_7@
1.编辑/usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf
vim /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf
[SeatDefaults]@H_502_7@
autologin-user=root@H_502_7@
user-session=ubuntu@H_502_7@
greeter-show-manual-login=true@H_502_7@
allow-guest=false@H_502_7@
@H_502_7@
2.编辑 /root/.profile
vim /root/.profile
将其更改为“tty -s && mesg n”@H_502_7@
3.用reboot命令重启即可
二、安装Openssh
1、Ubuntu 下安装OPenSSHServer
sudo apt-get install openssh-server@H_502_7@
2、对openssh server 进行配置
vim /etc/ssh/sshd_config@H_502_7@
找到permitRootLogin on一行,改为PermitRootLogin Yes@H_502_7@
3、重启openssh server
service sshd restart@H_502_7@
三、ssh client 报 algorithm negotiation Failed的解决方法之一
1、修改sshd的配置文件 /etc/ssh/sshd_config
Ciphers aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr,3des-cbc,arcfour128,arcfour256,arcfour,blowfish-cbc,cast128-cbc@H_502_7@
MACshmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-sha1-96,hmac-md5-96@H_502_7@
KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group1-sha1,curve25519-sha256@libssh.org@H_502_7@
@H_502_7@
@H_502_7@
2、重启服务
@H_502_7@
sudo /etc/init.d/ssh restart 重启sshd服务后,即可正常连接。@H_502_7@
四、同步时间
安装ntpdate工具@H_502_7@
# sudo apt-get install ntpdate@H_502_7@
1.首先查看时区:
date -R@H_502_7@
Tue,17 Dec 2013 18:23:01+0800@H_502_7@
@H_502_7@
@H_502_7@
@H_502_7@
2.选择区域:亚洲
sudo tzselect@H_502_7@
Please identify a locationso that time zone rules can be set correctly.@H_502_7@
Please select a continentor ocean.@H_502_7@
1) Africa@H_502_7@
2) Americas@H_502_7@
3) Antarctica@H_502_7@
4) Arctic Ocean@H_502_7@
5) Asia@H_502_7@
#? 5@H_502_7@
@H_502_7@
@H_502_7@
@H_502_7@
@H_502_7@
3.选择国家:中国
Please select a country.@H_502_7@
9) China 26) Laos 43) Taiwan@H_502_7@
#? 9@H_502_7@
@H_502_7@
@H_502_7@
4.选择时区:北京时间
Please select one of thefollowing time zone regions.@H_502_7@
1) east China - Beijing,Guangdong,Shanghai,etc.@H_502_7@
2) Heilongjiang (exceptMohe),Jilin@H_502_7@
#? 1@H_502_7@
@H_502_7@
@H_502_7@
@H_502_7@
@H_502_7@
5.确认验证:
Is the above informationOK?@H_502_7@
1) Yes@H_502_7@
2) No@H_502_7@
#? 1@H_502_7@
@H_502_7@
@H_502_7@
@H_502_7@
@H_502_7@
6.复制文件到/etc目录下
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime@H_502_7@
@H_502_7@
7.更新时间
sudo ntpdate time.windows.com@H_502_7@
五、安装YOucompleteme
1、卸载老版本vim
sudo apt-get remove vim
sudo apt-get remove vim-runtime
sudo apt-get remove gvim
sudo apt-get remove vim-tiny
sudo apt-get remove vim-common
sudo apt-get remove vim-gui-common
2、下载vim最新源码
cd ~@H_502_7@
git clonehttps://github.com/vim/vim.git@H_502_7@
3、进入vim
@H_502_7@
cd vim@H_502_7@
./configure--with-features=huge --enable-rubyinterp --enable-pythoninterp --with-python-config-dir=/usr/lib/python2.7/config-i386-linux-gnu/--enable-perlinterp --enable-gui=gtk2--enable-cscope --enable-luainterp --enable-perlinterp --enable-multibyte --prefix=/usr@H_502_7@
其中参数说明如下:@H_502_7@
--with-python-config-dir=/usr/lib/python2.7/config-i386-linux-gnu/指定 python 路径@H_502_7@
--prefix=/usr:编译安装路径@H_502_7@
sudo make VIMRUNTIMEDIR=/usr/share/vim/vim74@H_502_7@
sudo make install@H_502_7@
4、安装YouCompleteMe
a、下载
git clone --recursive git://github.com/Valloric/YouCompleteMe@H_502_7@
如果执行该命令没报错,就ok了. 但是中途有可能会断掉,可以 cd 到YouCompleteMe,然后反复用如下命令再次进行下载:@H_502_7@
git submodule update --init --recursive@H_502_7@
这个命令下载时间挺长的@H_502_7@
@H_502_7@
b、 安装
cd ~/.vim/bundle/YouCompleteMe@H_502_7@
./install.py --clang-completer@H_502_7@
成功的log如下:@H_502_7@
-- [download 99% complete]@H_502_7@
-- [download 100% complete]@H_502_7@
Using libclang to provide semantic completion for C/C++/ObjC@H_502_7@
Using external libclang: /tmp/ycm_build.CKY92s/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04/lib/libclang.so.3.8@H_502_7@
-- Found PythonInterp: /usr/bin/python2.7 (found version"2.7.11")@H_502_7@
-- Looking for pthread.h@H_502_7@
-- Looking for pthread.h - found@H_502_7@
-- Looking for pthread_create@H_502_7@
-- Looking for pthread_create - not found@H_502_7@
-- Looking for pthread_create in pthreads@H_502_7@
-- Looking for pthread_create in pthreads - not found@H_502_7@
-- Looking for pthread_create in pthread@H_502_7@
-- Looking for pthread_create in pthread - found@H_502_7@
-- Found Threads: TRUE @H_502_7@
-- Configuring done@H_502_7@
-- Generating done@H_502_7@
-- Build files have been written to: /tmp/ycm_build.CKY92s@H_502_7@
Scanning dependencies of target BoostParts@H_502_7@
[ 0%] Building CXX objectBoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/regex_raw_buffer.cpp.o@H_502_7@
[ 0%] Building CXX objectBoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/regex_debug.cpp.o@H_502_7@
[ 1%] Building CXX objectBoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/w32_regex_traits.cpp.o@H_502_7@
[ 2%] Building CXX objectBoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/wide_posix_api.cpp.o@H_502_7@
...@H_502_7@
[100%] Building CXX objectycm/CMakeFiles/ycm_core.dir/CustomAssert.cpp.o@H_502_7@
[100%] Linking CXX shared library/home/wuyt/mutils/debian_lenny_cfg/vim_cfg/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_core.so@H_502_7@
[100%] Built target ycm_core@H_502_7@
c、配置@H_502_7@
.vimrc中加入:@H_502_7@
" YouCompleteMe@H_502_7@
set runtimepath+=~/.vim/bundle/YouCompleteMe@H_502_7@
let g:ycm_collect_identifiers_from_tags_files = 1 " 开启 YCM 基于标签引擎@H_502_7@
let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 注释与字符串中的内容也用于补全@H_502_7@
let g:syntastic_ignore_files=[".*\.py$"]@H_502_7@
let g:ycm_seed_identifiers_with_Syntax = 1 " 语法关键字补全@H_502_7@
let g:ycm_complete_in_comments = 1@H_502_7@
let g:ycm_confirm_extra_conf = 0@H_502_7@
let g:ycm_key_list_select_completion = ['<c-n>','<Down>'] " 映射按键,没有这个会拦截掉tab,导致其他插件的tab不能用.@H_502_7@
let g:ycm_key_list_prevIoUs_completion = ['<c-p>','<Up>']@H_502_7@
let g:ycm_complete_in_comments = 1 " 在注释输入中也能补全@H_502_7@
let g:ycm_complete_in_strings = 1 " 在字符串输入中也能补全@H_502_7@
let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 注释和字符串中的文字也会被收入补全@H_502_7@
let g:ycm_global_ycm_extra_conf='~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'@H_502_7@
let g:ycm_show_diagnostics_ui = 0 " 禁用语法检查@H_502_7@
inoremap <expr> <CR> pumvisible() ?"\<C-y>" : "\<CR>" | " 回车即选中当前项@H_502_7@
nnoremap <c-j> :YcmCompleterGoToDefinitionElseDeclaration<CR>|" 跳转到定义处@H_502_7@
"let g:ycm_min_num_of_chars_for_completion=2 " 从第2个键入字符就开始罗列匹配项@H_502_7@
其中~/.vim/bundle/YouCompleteMe 为下载 YouCompleteMeu 的路径.@H_502_7@
六、安装NERDTree
wget http://www.vim.org/scripts/download_script.PHP?src_id=17123 -Onerdtree.zip@H_502_7@
@H_502_7@
unzip nerdtree.zip@H_502_7@
mkdir -p ~/.vim/{plugin,doc}@H_502_7@
cp plugin/NERD_tree.vim ~/.vim/plugin/@H_502_7@
cp doc/NERD_tree.txt ~/.vim/doc/@H_502_7@
安装好后,命令行中输入vim,打开vim后,在vim中输入:NERDTree,你就可以看到NERDTree的效果了。@H_502_7@