centos7整机安装

一套操作只要5分钟

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

BOOTPROTO=static
ONBOOT=yes

IPADDR=192.168.150.59
GATEWAY=192.168.150.2
NETMASK=255.255.255.0
DNS1=8.8.8.8

systemctl restart network
systemctl status network

ip addr
ping www.baidu.com

https://gitee.com/gduty17/others/blob/dev/CentOS-Base.repo
scp /etc/yum.repos.d/CentOS-Base.repo root@192.168.116.29:/etc/yum.repos.d/CentOS-Base.repo

yum clean all
yum -y makecache

systemctl stop firewalld
systemctl disable firewalld

修改CentOS-Base.repo

rm -rf /etc/yum.repos.d/CentOS-Base.repo
vi /etc/yum.repos.d/CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

yum更新

yum clean all 
yum makecache
yum -y update

时间同步

yum -y install ntp ntpdate
timedatectl
timedatectl set-local-rtc 1
timedatectl set-timezone Asia/Shanghai

ntpdate ntp1.aliyun.com

安装常用工具

yum -y install wget lrzsz unzip zip \
net-tools tree lsof bind-utils \
nc strace telnet psmisc

安装git

https://mirrors.edge.kernel.org/pub/software/scm/git/

wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.0.tar.gz

scp -r git-2.3.5 root@192.168.116.29:/root

tar zxf git-2.3.5.tar.gz
cd git-2.3.5
yum install -y gcc curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker

make && make install


git config --global user.name xxx
git config --global user.email 5550@qq.com
git config --list

ssh-keygen -t rsa -C '7vv10@qq.com'
cat ~/.ssh/id_rsa.pub
ssh -T git@github.com

go

https://golang.google.cn/
https://golang.google.cn/dl/

wget https://dl.google.com/go/go1.15.11.linux-amd64.tar.gz

https://golang.org/doc/install?download=go1.15.11.linux-amd64.tar.gz

rm -rf /usr/local/go && tar -C /usr/local -xzf go1.15.11.linux-amd64.tar.gz


vi /etc/profile
export GOROOT=/usr/local/go
export GOPATH=/root/go
PATH=$PATH:$GOROOT/bin:$GOPATH/bin

mkdir -p go/pkg; mkdir -p go/bin

source /etc/profile

go env -w GO111MODULE="on"
go env -w GOSUMDB=off
go env -w GOPROXY=https://goproxy.cn,direct
go env -w CGO_ENABLED="0"

go version

Windows vscode记住ssh密码
win生成公钥、私钥:

ssh-keygen -t rsa -C "x@qq.com"

linux:将win下的id_rsa.pub(公钥内容)复制到Linux下的authorized_keys文件

[root@node2 .ssh]# pwd
/root/.ssh
[root@node2 .ssh]# ll
total 16
-rw-r--r--. 1 root root  399 Feb 23 07:43 authorized_keys
-rw-------. 1 root root 1675 Feb  6 02:00 id_rsa
-rw-r--r--. 1 root root  398 Feb  6 02:00 id_rsa.pub
-rw-r--r--. 1 root root 1197 Feb  6 05:25 known_hosts
[root@node2 .ssh]#

vscode config指定目录

Host 192.168.150.59
  HostName 192.168.150.59
  User root
  IdentityFile "C:\Users\x\.ssh\id_rsa"

posted @ 2021-07-17 16:39  gdut17  阅读(125)  评论(0)    收藏  举报