ubuntu18.04初始化配置 [TOC] 虛擬機掛了, 又得重新安裝配置一遍, 這裡記錄了我幾乎每次都要配置安裝的那些軟體. ifconfig apt install net tools sshd sudo apt install ssh ifconfig xshell smb sudo apt ...
目錄
ubuntu18.04初始化配置
虛擬機掛了, 又得重新安裝配置一遍, 這裡記錄了我幾乎每次都要配置安裝的那些軟體.
ifconfig
apt install net-tools
sshd
sudo apt install ssh
ifconfig
xshell
smb
sudo apt install vim
sudo apt-get update
sudo apt-get install samba
vim /etc/samba/smb.conf (我的配置如下)
service smbd restart
sudo smbpasswd -a sola
[share]
comment = Public stuff
path = /home/sola/Coder
public = yes
writeable = yes
browseable = yes
guest ok = no
create mask = 0770
directory mode = 0770
#部分smb配置釋義, 不可直接複製粘貼 ,格式不對,smb會起不來. 要複製請用上面那段.
[share] #自定義共用名稱
comment = This is share software #共用描述
path = /home/ #共用目錄路徑
browseable = yes #設置共用是否可瀏覽,如果no就表示隱藏,需要通過IP+共用名稱進行訪問
writable = yes #設置共用是否具有可寫許可權
read only = no #設置共用是否具有隻讀許可權
admin users = root #設置共用的管理員,如果security =share,引項無效,多用戶中間使用逗號隔開,例如admin users = root,user1,user2
valid users = sola #設置允許訪問共用的用戶,例如valid users =
invalid users = sola #設置不允許訪問共用的用戶
write list = sola #設置在共用具有寫入許可權的用戶,例如例如write list =
public = no #設置共用是否允許guest賬戶訪問
create mask = 0770 #創建的文件許可權為770
directory mode = 0770 #創建的文件目錄為 770
other
sudo apt install git
sudo apt instal make
sudo apt install tree
vim 配置
vim ~/.vimrc
:set paste
下述配置拷貝自 :https://www.cnblogs.com/superxuezhazha/p/5677541.html
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
set nocompatible
" Vim5 and later versions support syntax highlighting. Uncommenting the
" following enables syntax highlighting by default.
"設置字元編碼
:set encoding=utf-8
:set fileencodings=ucs-bom,utf-8,cp936
:set fileencoding=utf-8
:set termencoding=utf-8
if has("syntax")
syntax on " 語法高亮
endif
colorscheme ron " elflord ron peachpuff default 設置配色方案,vim自帶的配色方案保存在/usr/share/vim/vim72/colors目錄下
" detect file type
filetype on
filetype plugin on
" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
set background=dark
" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
"have Vim load indentation rules and plugins according to the detected filetype
filetype plugin indent on
endif
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
"set ignorecase " 搜索模式里忽略大小寫
"set smartcase " 如果搜索模式包含大寫字元,不使用 'ignorecase' 選項。只有在輸入搜索模式並且打開 'ignorecase' 選項時才會使用。
set autowrite " 自動把內容寫迴文件: 如果文件被修改過,在每個 :next、:rewind、:last、:first、:previous、:stop、:suspend、:tag、:!、:make、CTRL-] 和 CTRL-^命令時進行;用 :buffer、CTRL-O、CTRL-I、'{A-Z0-9} 或 `{A-Z0-9} 命令轉到別的文件時亦然。
set autoindent " 設置自動對齊(縮進):即每行的縮進值與上一行相等;使用 noautoindent 取消設置
set smartindent " 智能對齊方式
set tabstop=4 " 設置製表符(tab鍵)的寬度
set softtabstop=4 " 設置軟製表符的寬度
set shiftwidth=4 " (自動) 縮進使用的4個空格
set cindent " 使用 C/C++ 語言的自動縮進方式
set cinoptions={0,1s,t0,n-2,p2s,(03s,=.5s,>1s,=1s,:1s "設置C/C++語言的具體縮進方式
"set backspace=2 " 設置退格鍵可用
set showmatch " 設置匹配模式,顯示匹配的括弧
set linebreak " 整詞換行
set whichwrap=b,s,<,>,[,] " 游標從行首和行末時可以跳到另一行去
"set hidden " Hide buffers when they are abandoned
set mouse=a " Enable mouse usage (all modes) "使用滑鼠
set number " Enable line number "顯示行號
"set previewwindow " 標識預覽視窗
set history=50 " set command history to 50 "歷史記錄50條
"--狀態行設置--
set laststatus=2 " 總顯示最後一個視窗的狀態行;設為1則視窗數多於一個的時候顯示最後一個視窗的狀態行;0不顯示最後一個視窗的狀態行
set ruler " 標尺,用於顯示游標位置的行號和列號,逗號分隔。每個視窗都有自己的標尺。如果視窗有狀態行,標尺在那裡顯示。否則,它顯示在屏幕的最後一行上。
"--命令行設置--
set showcmd " 命令行顯示輸入的命令
set showmode " 命令行顯示vim當前模式
"--find setting--
set incsearch " 輸入字元串就顯示匹配點
set hlsearch
"設置一鍵編譯
map <F5> :call CompileRunGcc()<CR>
imap <F5> <ESC>:call CompileRunGcc()<CR>
func! CompileRunGcc()
exec "w"
exec "cd %:p:h"
if &filetype == 'c'
exec "!g++ % -o %<"
exec "! ./%<"
elseif &filetype == 'cpp'
exec "!g++ % -o %<"
exec "! ./%<"
elseif &filetype == 'java'
exec "!javac %"
exec "!java %<"
elseif &filetype == 'sh'
:!./%
endif
endfunc
"設置pathonen插件可用
execute pathogen#infect()
" About NERDTree
noremap :<F2> NERDTreeToggle
autocmd vimenter * if !argc() | NERDTree | endif "open a NERDTree automatically when vim starts up if no files were specified
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
" TagBar 自動生成參數和方法
" Then the F8 key will toggle the Tagbar window.
nmap :<F8> TagbarToggle
"syntastic 保存檢查代碼時候傳入參數
let g:syntastic_java_javac_args="-cp ../../lib:../../bin -sourcepath ../../bin -Djava.ext.dirs=../../lib -d ../../bin"
" 關於Java自動文件補全插件
autocmd Filetype java set omnifunc=javacomplete#Complete
autocmd Filetype java set completefunc=javacomplete#CompleteParamsInf
最後
最好關機克隆一份, 免得以後掛了,又裝一道。