龙少的Linux配置大全

配置目录

  • 一、部署jar包
  • 二、mysql
  • 三、连接远程linux上的mysql
      • 1. mysql跳过密码验证
      • 2. 开机自启mysqld
  • 四、qt安装
  • 五、jdk1.8.0安装
  • 六、RHEL8
      • 1. 共享文件夹
      • 2. 本地yum源配置
      • 3. 清华dnf源配置
  • 七、putty安装(不推荐安装)
  • 八、vim配置:
    • 1. 克隆到本地
    • 2. 创建taglist数据库
    • 3. 编辑配置文件
    • 4. 自动下载插件
  • 九、MPlayer安装(不推荐安装)
  • 十、红帽8中文输入法:
  • 十一、RHEL8最小化安装:
      • 1. 设置语言环境:
      • 2. 查看网卡:
      • 3. 设置网卡:
      • 4. 重启网卡:
  • 十二、XShell6连接rhel8mini有警告:
  • 十三、ctags完整版:忽略一堆宏,可以找到被宏干扰的库函数。
  • 十四、windows远程桌面连接(xrdp服务)
  • 十五、Linux知识
      • 1. 设置普通用户不能修改自己密码
      • 2. 开机自动加载界面类型:
      • 3. 动态库.so创建:
      • 4. 查看当前路径的大小:
      • 5. grep查找路径下所有文件包含某个字符串
      • 6. 解压和压缩命令大全
      • 7. 防火墙操作:
  • 参考文献

一、部署jar包

  service mysqld restart <==>   systemctl restart mysqld
  ps -ef | grep spring-boot-juzimi-0.0.1-SNAPSHOT.jar
  java -jar spring-boot-juzimi-0.0.1-SNAPSHOT.jar >temp.txt &
  kill -9 PID

二、mysql

  yum install mysql-server mysql mysql-devel -y
  vim /etc/my.cnf

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
character-set-server=utf8
bind-address=0.0.0.0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[client]
default-character-set=utf8

[mysql]
default-character-set=utf8

  如果缺失mysql.sock,则给/var/lib/mysql文件夹添加所有权限,即:chmod 777 /var/lib/mysql

三、连接远程linux上的mysql

  进入mysql,执行以下语句:

# 允许所有用户远程访问,修改用户名和密码为你自己的(root, admin)
GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY 'admin' WITH GRANT OPTION;
# 更新权限
FLUSH PRIVILEGES;

1. mysql跳过密码验证

  在/etc/my.cnf的mysqld下添加skip-grant-tables
  重启mysql服务,执行mysql -uroot -p,password可以直接回车跳过。

2. 开机自启mysqld

  systemctl enable mysqld

四、qt安装

  chmod +x qt*.run
  /qt*.run

五、jdk1.8.0安装

  mv *.tar.gz /usr/java/
  tar -xzvf *.tar.gz
  vim /etc/profile

export JAVA_HOME=/usr/java/jdk1.8.0_231
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib
export PATH=$JAVA_HOME/bin:$PATH

六、RHEL8

1. 共享文件夹

  vim /etc/rc.local

vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other -o nonempty

  偶尔出现不好使的情况,查看文件权限:
  “ll /etc/rc.local” 发现 “-rwxrwxrwx … /etc/rc.local -> rc.d/rc.local”
  在/etc/下发现rc.d文件夹,里面还有一个rc.local文件,ll发现缺少很多权限,将其修改权限,问题解决:
  chmod 777 /etc/rc.d/rc.local

2. 本地yum源配置

  find / -name BaseOS
  将结果的BaseOS路径复制,比如是:/run/media/ls/RHEL-8-0-0-BaseOS-x86_64/BaseOS
  vim /etc/yum.repos.d/media.repo

# "/run/media/ls/RHEL-8-0-0-BaseOS-x86_64/" is previous(find / -name BaseOS) url
[BaseOS]
name=BaseOS
baseurl=file:///run/media/ls/RHEL-8-0-0-BaseOS-x86_64/BaseOS
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
enabled=1

[AppStream]
name=AppStream
baseurl=file:///run/media/ls/RHEL-8-0-0-BaseOS-x86_64/AppStream
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta

  yum repolist

3. 清华dnf源配置

  vim /etc/yum.repos.d/rhel-8-beta.repo

[rhel-8-baseos-beta-source-rpms]
name = Red Hat Enterprise Linux 8 - BaseOS Beta (Source RPMs)
baseurl = https://downloads.redhat.com/redhat/rhel/rhel-8-beta/baseos/source/
enabled = 1
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-8-for-aarch64-baseos-beta-rpms]
name = Red Hat Enterprise Linux 8 for ARM 64 - BaseOS Beta (RPMs)
baseurl = https://downloads.redhat.com/redhat/rhel/rhel-8-beta/baseos/aarch64/
enabled = 1
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-8-for-ppc64le-baseos-beta-rpms]
name = Red Hat Enterprise Linux 8 for Power, little endian - BaseOS Beta (RPMs)
baseurl = https://downloads.redhat.com/redhat/rhel/rhel-8-beta/baseos/ppc64le/
enabled = 1
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-8-for-s390x-baseos-beta-rpms]
name = Red Hat Enterprise Linux 8 for IBM z Systems - BaseOS Beta (RPMs)
baseurl = https://downloads.redhat.com/redhat/rhel/rhel-8-beta/baseos/s390x/
enabled = 1
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-8-for-x86_64-baseos-beta-rpms]
name = Red Hat Enterprise Linux 8 for x86_64 - BaseOS Beta (RPMs)
baseurl = https://downloads.redhat.com/redhat/rhel/rhel-8-beta/baseos/x86_64/
enabled = 1
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-8-appstream-beta-source-rpms]
name = Red Hat Enterprise Linux 8 - AppStream Beta (Source RPMs)
baseurl = https://downloads.redhat.com/redhat/rhel/rhel-8-beta/appstream/source/
enabled = 1
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-8-for-aarch64-appstream-beta-rpms]
name = Red Hat Enterprise Linux 8 for ARM 64 - AppStream Beta (RPMs)
baseurl = https://downloads.redhat.com/redhat/rhel/rhel-8-beta/appstream/aarch64/
enabled = 1
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-8-for-ppc64le-appstream-beta-rpms]
name = Red Hat Enterprise Linux 8 for Power, little endian - AppStream Beta (RPMs)
baseurl = https://downloads.redhat.com/redhat/rhel/rhel-8-beta/appstream/ppc64le/
enabled = 1
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-8-for-s390x-appstream-beta-rpms]
name = Red Hat Enterprise Linux 8 for IBM z Systems - AppStream Beta (RPMs)
baseurl = https://downloads.redhat.com/redhat/rhel/rhel-8-beta/appstream/s390x/
enabled = 1
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-8-for-x86_64-appstream-beta-rpms]
name = Red Hat Enterprise Linux 8 for x86_64 - AppStream Beta (RPMs)
baseurl = https://downloads.redhat.com/redhat/rhel/rhel-8-beta/appstream/x86_64/
enabled = 1
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-8-ha-beta-source-rpms]
name = Red Hat Enterprise Linux 8 - HighAvailability Beta (Source RPMs)
baseurl = https://downloads.redhat.com/redhat/rhel/rhel-8-beta/add-ons/ha/source/
enabled = 1
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-8-for-ppc64le-ha-beta-rpms]
name = Red Hat Enterprise Linux 8 for Power, little endian - HighAvailability Beta (RPMs)
baseurl = https://downloads.redhat.com/redhat/rhel/rhel-8-beta/add-ons/ha/ppc64le/
enabled = 1
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-8-for-s390x-ha-beta-rpms]
name = Red Hat Enterprise Linux 8 for IBM z Systems - HighAvailability Beta (RPMs)
baseurl = https://downloads.redhat.com/redhat/rhel/rhel-8-beta/add-ons/ha/s390x/
enabled = 1
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-8-for-x86_64-ha-beta-rpms]
name = Red Hat Enterprise Linux 8 for x86_64 - HighAvailability Beta (RPMs)
baseurl = https://downloads.redhat.com/redhat/rhel/rhel-8-beta/add-ons/ha/x86_64/
enabled = 1
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-8-rs-beta-source-rpms]
name = Red Hat Enterprise Linux 8 - ResilientStorage Beta (Source RPMs)
baseurl = https://downloads.redhat.com/redhat/rhel/rhel-8-beta/add-ons/rs/source/
enabled = 1
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-8-for-ppc64le-rs-beta-rpms]
name = Red Hat Enterprise Linux 8 for Power, little endian - ResilientStorage Beta (RPMs)
baseurl = https://downloads.redhat.com/redhat/rhel/rhel-8-beta/add-ons/rs/ppc64le/
enabled = 1
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-8-for-s390x-rs-beta-rpms]
name = Red Hat Enterprise Linux 8 for IBM z Systems - ResilientStorage Beta (RPMs)
baseurl = https://downloads.redhat.com/redhat/rhel/rhel-8-beta/add-ons/rs/s390x/
enabled = 1
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-8-for-x86_64-rs-beta-rpms]
name = Red Hat Enterprise Linux 8 for x86_64 - ResilientStorage Beta (RPMs)
baseurl = https://downloads.redhat.com/redhat/rhel/rhel-8-beta/add-ons/rs/x86_64/
enabled = 1
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-8-rt-beta-source-rpms]
name = Red Hat Enterprise Linux 8 - RT Beta (Source RPMs)
baseurl = https://downloads.redhat.com/redhat/rhel/rhel-8-beta/add-ons/rt/source/
enabled = 1
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-8-for-x86_64-rt-beta-rpms]
name = Red Hat Enterprise Linux 8 for x86_64 - RT Beta (RPMs)
baseurl = https://downloads.redhat.com/redhat/rhel/rhel-8-beta/add-ons/rt/x86_64/
enabled = 1
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

  dnf clean all
  dnf makecache

七、putty安装(不推荐安装)

  wget https://the.earth.li/~sgtatham/putty/0.73/putty-0.73.tar.gz
  tar -xzvf *.tar.gz

八、vim配置:

1. 克隆到本地

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

2. 创建taglist数据库

ctags -I __THROW -I __MALLOC_DEPRECATED -I __REDIRECT -I __REDIRECT_NTH -I __REDIRECT_NTHNL -I __THROWNL -I __attribute_const__ -I __attribute_deprecated__ -I __attribute_malloc__ -I __attribute_pure__ -I __wur -I __nonnull -I __attribute__ -R --fields=+ialS --extra=+q --c-kinds=+px --c++-kinds=+px -f ~/.vim/systags /usr/include/ /usr/local/include/

3. 编辑配置文件

  vim ~/.vimrc

" ----------------------------- Vundle Start -----------------------------
set nocompatible
filetype off                                                                                                                                                           
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

" 这里放插件名
" Github其他仓库的插件:'仓库名/插件名'

Plugin 'VundleVim/Vundle.vim'
" rainbow_parentheses 括号深层高亮
Plugin 'kien/rainbow_parentheses.vim'
" EchoFunc:提示函数原型
Plugin 'mbbill/echofunc'
" vim-colors-solarized:颜色配置
Plugin 'altercation/vim-colors-solarized'
" NERDTree 文件树  -->  和WinManager不兼容,暂时不用
"Plugin 'scrooloose/nerdtree'
" 多文件同时编辑
Plugin 'fholgado/minibufexpl.vim'
" 状态栏加强
Plugin 'bling/vim-airline'

" Github vim-scripts仓库的插件:'插件名'

" <F12>切换头/源文件
Plugin 'a.vim'
" 自动生成文件头、函数、结构体等功能
Plugin 'c.vim'
" 基于ctags库的左侧列表
Plugin 'taglist.vim'
" 自定义函数、结构体、全局变量高亮
Plugin 'taghighlight'
" 类、结构体成员提示
Plugin 'OmniCppComplete'
" 辅助OmniCppComplete,将简化为
Plugin 'SuperTab'
" WinManager:Taglist和netrw整合
Plugin 'winmanager'

" 其他网络:'路径名'
"Plugin '[email protected]:ziying.liuziying/studyvim.git'

" 本地库
"Plugin 'file:///home/gmarik/path/to/plugin'

call vundle#end()
filetype plugin indent on
" ----------------------------- Vundle End   -----------------------------

" 显示行号
set number
" 自动缩进
set cindent
" 继承前一行的缩进方式,适用于多行注释
set autoindent
" 为C程序提供自动缩进
set smartindent
" 设置自动缩进长度为4空格
set shiftwidth=4
" 设置Tab长度为4空格
set tabstop=4
" 不要用空格代替制表符
set noexpandtab
" 代码高亮
set syntax=on
" 去掉输入错误的提示声音
set noeb
" 行首和行末按左右键可以自动切换到上一行或者下一行
set whichwrap=b,s,<,>,[,]
" 高亮显示匹配的括号
set showmatch
" 匹配括号高亮的时间(单位是十分之一秒)
set matchtime=1
" 突出当前行
set cursorline
" 可以在buffer的任何地方使用鼠标(类似office中在工作区双击鼠标定位)
"set mouse=a
"set selection=exclusive
"set selectmode=mouse,key
" 在被分割的窗口间显示空白,便于阅读
set fillchars=vert:\|,stl:\ ,stlnc:\-
" 粘贴内容时不会有任何格式变形、胡乱缩进等问题
"set paste		"开了这个,autoindent会失效
"
" 我的状态行显示的内容(包括文件类型和解码)
" %=:右对齐
"
" %F:当前文件名(绝对路径)		-->		"/etc/vimrc"
" %Y:当前文件类型(大写)		-->		"VIM"
" %y:当前文件类型([小写])		-->		"[vim]"
" %l:当前所在行				-->		"128"
" %L:总行数					-->		"344"
" %c:当前所在列				-->		"33"
" %p:当前行占总行数的百分比	-->		"38"
" %%:百分号					-->		"%"
" %r:当前文件是否只读			-->		"[只读]"
" %m:当前文件修改状态			-->		"[+]"
" %b:当前光标处字符的ASCLL码	-->		"32"
" %V:当前光标虚拟列号			-->		当前行没有内容时显示 "-1"
"
" %{strftime(\"%y/%m/%d\ -\ %H:%M\")}:当前时间			-->		"20/05/22 - 22:15"
" %{&ff}:文件编码				-->		"unix"
" %{EchoFuncGetStatusLine()}:EchoFunc函数提示			-->		"__NTH(bzero(void* *__dest, size_t __len) (1/1) /usr/include/bits/strings_fortified.h"
"
" %h:???
" %w:???
" %*:???
set statusline=[%F]%y%r%m\ %{EchoFuncGetStatusLine()}\ %=[%l/%L,%c][%p%%]
" 总是显示状态栏
set laststatus=2
" 命令行(在状态行下)的高度,默认为1,这里是2
set cmdheight=2
" 显示当前指令
set showcmd
" 显示光标当前位置
set ruler
" 自动保存
set autowrite
" 历史记录数
set history=1000
" 禁止生成临时文件
set nobackup
set noswapfile
" 搜索忽略大小写
"set ignorecase
" 字符间插入的像素行数目
set linespace=0
" 光标移动到buffer的顶部和底部时保持3行距离
set scrolloff=3
"自动补全
:inoremap ( ()i
:inoremap ) =ClosePair(')')
:inoremap { {}i
:inoremap } =ClosePair('}')
:inoremap [ []i
:inoremap ] =ClosePair(']')
:inoremap " ""<ESC>i
:inoremap ' ''i
function! ClosePair(char)
	if getline('.')[col('.') - 1] == a:char
		return "\"
	else
		return a:char
	endif
endfunction
filetype plugin indent on 
" 打开文件类型检测, 加了这句才可以用智能补全
set completeopt=longest,menu
" 使用vim主题,颜色不会被终端影响
if has("gui_runing")              "如果在图形用户界面
    set background=light          "设置背景色为亮色
else                              "设置背景色为深色
    set background=dark           "就开启256色支持,默认为8色  
    set t_Co=256
endif
colorscheme solarized

" 代码提示
" 添加库函数ctags命令:
" -I:忽略一堆宏
"ctags -I __THROW -I __MALLOC_DEPRECATED -I __REDIRECT -I __REDIRECT_NTH -I __REDIRECT_NTHNL -I __THROWNL -I __attribute_const__ -I __attribute_deprecated__ -I __attribute_malloc__ -I __attribute_pure__ -I __wur -I __nonnull -I __attribute__ -R --fields=+ialS --extra=+q --c-kinds=+px --c++-kinds=+px -f ~/.vim/systags /usr/include/ /usr/local/include/
set tags+=~/.vim/systags
set autochdir

" 折叠
set foldenable
set foldmethod=syntax
nmap  za

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"	> vim插件配置
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

" taglist配置
let Tlist_Ctags_Cmd = '/usr/bin/ctags'
let Tlist_WinWidth=30
let Tlist_WinHeight=40
let Tlist_Auto_Highlight_Tag=1
let Tlist_Sort_Type="name"
"let Tlist_Auto_Open=1
let Tlist_Auto_Update=1
let Tlist_Display_Tag_Scope=1
let Tlist_Exit_OnlyWindow=1
let Tlist_Enable_Dold_Column=1
let Tlist_File_Fold_Auto_Close=1
let Tlist_Show_One_File=1
"let Tlist_Use_Right_Window=1
let Tlist_Use_SingleClick=1
let Tlist_Max_Tag_Length=30
nmap  tl :TlistToggle
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascrīpt set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete

" NERDTree 文件树  -->  和WinManager不兼容,暂时不用
"let g:NERDTree_title='NERD Tree'
"function! NERDTree_Start()
"	exec 'NERDTree'
"endfunction
"function! NERDTree_IsValid()
"	return 1
"endfunction
" 自动启动
"autocmd vimenter * NERDTree
" 修改树的显示图标
"let g:NERDTreeDirArrowExpandable = '+'
"let g:NERDTreeDirArrowCollapsible = '-'
" 窗口位置
"let g:NERDTreeWinPos='left'
" 窗口尺寸
"let g:NERDTreeSize=30
" 窗口是否显示行号
"let g:NERDTreeShowLineNumbers=1
" 不显示隐藏文件
"let g:NERDTreeHidden=0

" WinManager:Taglist和netrw整合
" 整合NERDTree的时候,有点不兼容
let g:winManagerWindowLayout='FileExplorer|TagList'
let g:winManagerWidth=30
let g:AutoOpenWinManager=1
nmap  wm :WMToggle
"autocmd BufEnter * if (winnr("$") == 3 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | qa | endif

" MiniBufExplorer:多文件同时编辑
let g:miniBufExplMapWindowNavVim=1
let g:miniBufExplMapWindowNavArrows=1
let g:miniBufExplMapCTabSwitchBufs=1
let g:miniBufExplModSelTarget=1
let g:miniBufExplForceSyntaxEnable=1
let g:miniBufExplorerMoreThanOne=0

" EchoFunc:提示函数原型
" 配置文件里,EchoFuncKeyNext和EchoFuncKeyPrev变量,可以设置前后提示的切换
"let g:EchoFuncShowOnStatus=1
let g:EchoFuncLangsUsed=["c","cpp","h"]
nmap   :!ctags -R --fields=+ialS --extra=+q --c-kinds=+px --c++-kinds=+px .

" EasyGrep:搜索
" 路径不能用~/.vim/...    不知道为什么,必须写/root/.vim/...
let g:EasyGrepFileAssociations='/root/.vim/plugin/EasyGrepFileAssociations'
let g:EasyGrepMode=2
let g:EasyGrepCommand=0
let g:EasyGrepRecursive=1
let g:EasyGrepHidden=1
let g:EasyGrepFilesToExclude="*.bak, *~, cscope.*, *.a, *.o, *.pyc, *.bak"
let g:EasyGrepAllOptionsInExplorer=1
let g:EasyGrepWindow=0
let g:EasyGrepJumpToMatch=1
let g:EasyGrepInvertWholeWord=1
let g:EasyGrepFileAssociationsInExplorer=1
let g:EasyGrepReplaceWindowMode=1

" cscope
set cscopequickfix=s-,c-,d-,i-,t-,e-
" 每次启动都加载,太慢了,不一定会用到,改为手动
"autocmd VimEnter * cs add /usr/include/cscope.out
nmap  cs  :cs add /usr/include/cscope.out
nmap s :cs find s =expand("<cword>")
nmap g :cs find g =expand("<cword>")
nmap c :cs find c =expand("<cword>")
nmap t :cs find t =expand("<cword>")
nmap e :cs find e =expand("<cword>")
nmap f :cs find f =expand("<cfile>")
nmap i :cs find i ^=expand("<cfile>")$
nmap d :cs find d =expand("<cword>")

" a.vim
nmap <silent> <F12> :A<CR>

" rainbow_parentheses 括号深层高亮
let g:rbpt_max=14
let g:rbpt_loadcmd_toggle=0
autocmd VimEnter * RainbowParenthesesToggle
autocmd Syntax * RainbowParenthesesLoadRound
autocmd Syntax * RainbowParenthesesLoadSquare
autocmd Syntax * RainbowParenthesesLoadBraces

" taghighlight自定义函数、结构体、全局变量高亮
" 全局变量
hi CTagsGlobalVariable ctermfg=Blue cterm=none
" 结构体成员
hi CTagsMember ctermfg=Blue cterm=none
autocmd VimEnter * UpdateTypesFile

" OmniCppComplete
let OmniCpp_NamespaceSearch=1
let OmniCpp_GlobalScopeSearch=1
let OmniCpp_ShowAccess=1
let OmniCpp_ShowPrototypeInAbbr=1	" show function parameters
let OmniCpp_MayCompleteDot=1		" autocomplete after .
let OmniCpp_MayCompleteArrow=1	" autocomplete after ->
let OmniCpp_MayCompleteScope=1	" autocomplete after ::
let OmniCpp_SelectFirstItem=2

" SuperTab
let g:SuperTabRetainCompletionType=2
let g:SuperTabDefaultCompletionType=""

" vim-colors-solarized:颜色配置
let g:solarized_termcolors=256
let g:solarized_termtrans=0
let g:solarized_degrade=0
let g:solarized_bold=1
let g:solarized_underline=1
let g:solarized_italic=1
let g:solarized_contrast="normal"
let g:solarized_visibility="normal"
let g:solarized_hitrail=0
let g:solarized_menu=1

" 状态栏加强
set laststatus=2

4. 自动下载插件

1. 先保存上面的配置
:w
2. 执行自动下载插件命令
:PluginInstall
3. 保存并退出,下次再使用vim时减小
:wqa

九、MPlayer安装(不推荐安装)

  自己安装的软件都放在这个目录:cd /usr/local/share/
  安装依赖yasm(红帽8):wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
  tar -xzvf yasm-1.3.0.tar.gz
  cd yasm-1.3.0/
  ./configure
  make
  make install
  返回安装目录:cd …
  wget http://www.mplayerhq.hu/MPlayer/releases/MPlayer-1.4.tar.gz
  tar -xzvf MPlayer-1.4.tar.gz
  cd MPlayer-1.4/
  ./configure
  make
  make install

十、红帽8中文输入法:

  dnf install ibus-libpinyin.x86_64 -y
  设置-语言-添加-中文-中文拼音
  win+space切换输入法

十一、RHEL8最小化安装:

1. 设置语言环境:

  vi /etc/profile

export LC_ALL=zh_CN.UTF-8

  vi /etc/locale.config

LANG="zh_CN.UTF-8"
LC_ALL="zh_CN.UTF-8"

  source /etc/profile
  source /etc/locale.config

2. 查看网卡:

  ip addr

3. 设置网卡:

  vi /etc/sysconfig/network-scripts/ifcfg-ens160

" 修改
BOOTPROTO=static
ONBOOT=yes
" 添加
IPADDR=192.168.1.6
PREFIX=24
GATEWAY=192.168.1.1
NETMASK=255.255.255.0
DNS1=114.114.114.114

4. 重启网卡:

  systemctl restart NetworkManager

十二、XShell6连接rhel8mini有警告:

WARNING! The remote SSH server rejected X11 forwarding request.

  yum install xorg-x11-xauth -y
  systemctl restart sshd

十三、ctags完整版:忽略一堆宏,可以找到被宏干扰的库函数。

  -f:指定tags包生成路径
  最后的 /usr/include/ /usr/local/include/ 是指定要打包的路径,常用的就这俩,可自行添加。

ctags -I __THROW -I __MALLOC_DEPRECATED -I __REDIRECT -I __REDIRECT_NTH -I __REDIRECT_NTHNL -I __THROWNL -I __attribute_const__ -I __attribute_deprecated__ -I __attribute_malloc__ -I __attribute_pure__ -I __wur -I __nonnull -I __attribute__ -R --fields=+ialS --extra=+q --c-kinds=+px --c++-kinds=+px -f ~/.vim/systags /usr/include/ /usr/local/include/

十四、windows远程桌面连接(xrdp服务)

yum install epel-release xrdp -y
systemctl start xrdp
systemctl enable xrdp

十五、Linux知识

1. 设置普通用户不能修改自己密码

  chmod 755 /usr/bin/passwd 之后,普通用户将不能修改自己的密码。

2. 开机自动加载界面类型:

  systemctl set-default xxx.target
  字符界面:multi-user.target
  图形界面:graphical.target

3. 动态库.so创建:

  gcc -c *.c -Wall -fPIC
  gcc *.o -o libls.so -shared

4. 查看当前路径的大小:

  du -sh
  du -sh *

5. grep查找路径下所有文件包含某个字符串

  grep [“字符串”] -r [路径] -n
  find . -name “*.cpp” | xargs grep “myfunction”

6. 解压和压缩命令大全

解包:tar xvf FileName.tar
打包:tar cvf FileName.tar DirName(注:tar是打包,不是压缩!)
 
02-.gz格式
解压1:gunzip FileName.gz
解压2:gzip -d FileName.gz
压 缩:gzip FileName
 
03-.tar.gz格式
解压:tar zxvf FileName.tar.gz
压缩:tar zcvf FileName.tar.gz DirName
 
04-.bz2格式
解压1:bzip2 -d FileName.bz2
解压2:bunzip2 FileName.bz2
压 缩:bzip2 -z FileName
 
05-.tar.bz2格式
解压:tar jxvf FileName.tar.bz2
压缩:tar jcvf FileName.tar.bz2 DirName
 
06-.bz格式
解压1:bzip2 -d FileName.bz
解压2:bunzip2 FileName.bz
 
07-.tar.bz格式
解压:tar jxvf FileName.tar.bz
 
08-.Z格式
解压:uncompress FileName.Z
压缩:compress FileName
 
09-.tar.Z格式
解压:tar Zxvf FileName.tar.Z
压缩:tar Zcvf FileName.tar.Z DirName
 
10-.tgz格式
解压:tar zxvf FileName.tgz
 
11-.tar.tgz格式
解压:tar zxvf FileName.tar.tgz
压缩:tar zcvf FileName.tar.tgz FileName
 
12-.zip格式
解压:unzip FileName.zip
压缩:zip FileName.zip DirName
 
13-.lha格式
解压:lha -e FileName.lha
压缩:lha -a FileName.lha FileName
 
14-.rar格式
解压:rar a FileName.rar
压缩:rar e FileName.rar
rar请到:下载!
解压后请将rar_static拷贝到/usr/bin目录(其他由$PATH环境变量
指定的目录也行):cp rar_static /usr/bin/rar
 
15-.tar.xz格式
解压:xz -d xxx.tar.xz --> tar -xvf xxx.tar

7. 防火墙操作:

  关闭/开启防火墙:systemctl stop/start firewalld.service
  禁止/允许防火墙开机自动启动:systemctl disable/enable firewalld.service
  检查防火墙状态:firewall-cmd --state
  开放80端口:firewall-cmd --permanent --add-port=80/tcp
  重新加载防火墙:firewall-cmd --reload

参考文献

  1. springboot打包部署到linux服务器
  2. 安装vmtools之后在/mnt目录下没有hgfs文件夹
  3. RedHat8.0配置本地yum源
  4. RedHat 8 dnf源配置
  5. linux查看根目录下所有文件夹大小的方法
  6. ctags 命令及使用(1)
  7. linux把文件压缩成.tar.gz的命令
  8. Windows10下安装mysql-8.0.19-winx64及修改初始密码
  9. Vim技能修炼教程(1) - 使用vundle管理插件
  10. 【Vim】使用Vundle管理配置Vim基本插件
  11. centos8 安装Windows远程桌面

后记:
  一些配置是很久以前写的了,相关文献已经忘了,找不到了。
  如有雷同,请和我联系。
  支持原创,谢谢( ̄▽ ̄)"。

你可能感兴趣的:(配置大全)