Centos-7 install
1、虚拟机安装
#设置主机名
hostnamectl set-hostname singlekb17
#查看主机
hostname
#配置ip地址
vi /etc/sysconfig/network-scripts/ifcfg-ens33
BOOTPROTO=static
IPADDR=192.168.6.130
NETMASK=255.255.255.0
GATEWAY=192.168.6.2
DNS1=8.8.8.8
DNS2=114.114.114.114
#关闭并禁用防火墙
systemctl stop firewalld
systemctl disable firewalld
#查看防火墙状态
systemctl status firewalld
#关闭并禁用NetworkMananger
systemctl stop NetworkManager
systemctl disable NetworkManager
systemctl status NetworkManager
#重启网络服务
systemctl restart network
#查看ip地址
ip addr
#ping 内外网
#外网
ping www.baidu.com
#内网
ping 192.168.6.130
#linux主机名和ip映射
vi /etc/hosts
192.168.6.130 singlekb17
#windows主机和ip映射
C:\Windows\System32\drivers\etc\hosts
192.168.6.130 singlekb17
#简单优化
vi /etc/selinux/config
SELINUX=disable
iptables -F
setenforce 0
vi /etc/ssh/sshd_config
UseDNS no
#重启ssh服务
systemctl restart sshd
二、环境安装
#为节约系统资源,选择最小化安装 minimal install
#zai iso镜像中保留所有未安装资源
#选择制作本地仓库
#绿色安装 解压配置即可使用
#rpm 可执行文件安装
#yum 系统资源库(iso,yum源)
#make 手工编译
#linux系统目录
/bin #命令集
/lib #资源库
/lib64 #资源库
/etc #系统配置信息
/home #root之外其他用户默认根目录
/root #root超级用户的根目录
/dev #设备文件目录
/mnt #挂载
/opt #可选安装(绿色安装)
/usr #rpm
#选择制作本地仓库
cd /etc/yum.repos.d/
mkdir bak
mv *.repo bak/
mount /dev/sr0 /mnt/
vi base.repo
---------------
[local]
name=local
baseurl=file:///mnt
gpgcheck=0
enabled=1
---------------
yum -y install net-tools
yum -y install wget #异常执行 rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
yum -y install lrzsz
yum -y install vim
#配置华为
wget -o CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-7-reg.repo
wget -O CentOs-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
rm -rf CentOS-Base.repo
mv CentOS-7-reg.repo CentOS-Base.repo
#yum 更新
yum clean all
yum makecache
yum update -y
yum -y install lrzsz
三、jdk和scala安装
#勾选follow terminal folder
cd /opt/
mkdir download software
cd download
#将资源文件拖拽到侧边目录区
#解压到/opt/software
tar -zxvf jdk-8u171-linux-x64.tar.gz -C /opt/software
tar -zxvf scala-2.12.10.tgz -C /opt/software
#配置环境变量
cd /etc/profile.d/
vi kb17.sh
#jdk
JAVA_HOME=/opt/software/jdk1.8.0_171
PATH=$JAVA_HOME/bin:$PATH
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
#scala
SCALA_HOME=/opt/software/scala-2.12.10
PATH=$SCALA_HOME/bin:$PATH
#激活环境变量
source /etc/profile
#验证环境变量
java -version
#java version 1.8.0_171
#Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
#Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)
scala -version
#Scala code runner version 2.12.10 -- Copyright 2002-2019, LAMP/EPFL and Lightbend, Inc.
四、Mysql安装
#rpm安装mysql
#查看是否存在mysql旧版本
rpm -qa|grep mariadb
#mariadb-libs-5.5.65-1.el7.x86_64
yum -y remove mariadb-libs-5.5.65-1.el7.x86_64
#complete
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
wget http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
#100%
rpm -ivh mysql-community-release-el7-5.noarch.rpm
#yum localinstall mysql57-community-release-el7-10.noarch.rpm
#100%
yum -y install mysql-server
#complete
systemctl status mysql
#inactive
systemctl start mysql
#active(running)
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
#mysql 首次安装完成
1、mysql + enter 可以直接进入
2、mysql + enter 无法进入
vim /etc/my.cnf
----------------
skip-grant-tables #免密登录
----------------
systemctl restart mysql
#设置本地和远程访问木马
#查看用户信息
use mysql;
select host,user,password from user;
#设置本地登录密码
update user set password = password('root') where user ='root';
#设置远程访问密码
grant all on *.* to root@'%' IDENTIFIED by 'kb17';
#刷新
flush privileges;