【Linux】服務器更換配置伴隨方案

1.添加新用戶並授權

一、創建賬號

創建 username 舉例

1.創建

[root@localhost ~]# adduser username
[root@localhost ~]# passwd username
#此時,輸入兩次密碼即可

2.賦予sudo

#找到sudoers
[root@localhost ~]# whereis sudoers

#修改sudoers的讀寫權限
[root@localhost ~]# chmod -v u+w /etc/sudoers

#加入新用戶

## Allow root to run any commands anywher  
root    ALL=(ALL)       ALL  
username  ALL=(ALL)       ALL  #這個是新增的用戶

#把sudoers權限還給他
[root@localhost ~]# chmod -v u-w /etc/sudoers

二、Vim輔助工具配置(Vim + YCM + 各種依賴一鍵搞定)~湯老哥大法

工具出處:https://gitee.com/HGtz2222/VimForCpp

推薦超級管理者root下一鍵完成無煩惱
curl -sLf https://gitee.com/HGtz2222/VimForCpp/raw/master/install.sh -o ./install.sh && bash ./install.sh

在這裏插入圖片描述

三、git安裝以及連接git倉庫(我這裏演示碼雲的鏈接)

1.下載

yum -y install git #yum安裝
git git --version #版本

2.生成ssh公鑰

ssh-keygen -t rsa -C “youremail addr” 輸入你的郵箱生成一個rsa祕鑰
配置git用戶參數
git config --global user.name “your name”
git config --global user.email “your email”
默認生成的祕鑰存在 ~/.ssh/ 中
id_rsa 即爲接下來要用到的祕鑰
在這裏插入圖片描述

3.設置碼雲ssh公鑰

在這裏插入圖片描述

4.關聯你的碼雲倉庫到本地

git clone 碼雲倉庫SSH地址 /網站根目錄
接下來就可以
git add
git commit -m “備註”
git push

四、gcc升級

root下三步完成然後檢查gcc版本

yum install centos-release-scl -y
yum install devtoolset-7 -y
scl enable devtoolset-7 bash
gcc --version

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章