当前位置: 首页>数据库>正文

重新搭建centos环境

一 配置桥接模式:

重新搭建centos环境,第1张
桥接模式

二 做关联网卡

重新搭建centos环境,第2张
重新搭建centos环境,第3张

选择对应网卡:


重新搭建centos环境,第4张

三设置静态IP

安装的时候直接设置一个,简单忽略.

四 配置dns

vim /etc/resolve.conf
#添加以下内容,根据需要修改
nameserver 192.168.0.1

五 关闭防火墙默认启动系统服务

#关闭防火墙
systemctl disable firewalld.service 
systemctl stop firewalld.service 

# 启动ssh
systemctl start sshd.service

 chkconfig --level 35 sshd on

五 更换清华的源

cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
vim  /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
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-7

#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-7



#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-7



#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-7


执行命令:

 yum makecache

安装mysql

 yum install mariadb-server -y
 yum install mariadb-client  -y
 yum install mariadb-devel -y
 
 systemctl start mariadb.service
 systemctl enable mariadb.service
重新搭建centos环境,第5张
报错信息

看下具体原因:

[root@localhost Mysql]# journalctl -xe
Nov 12 20:59:28 localhost.localdomain systemd[1]: mariadb.service: control process exited, code=exited status=1
Nov 12 20:59:28 localhost.localdomain systemd[1]: Failed to start MariaDB database server.
-- Subject: Unit mariadb.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mariadb.service has failed.
-- 
-- The result is failed.
Nov 12 20:59:28 localhost.localdomain systemd[1]: Unit mariadb.service entered failed state.
Nov 12 20:59:28 localhost.localdomain systemd[1]: mariadb.service failed.
Nov 12 20:59:28 localhost.localdomain polkitd[552]: Unregistered Authentication Agent for unix-process:52939:924732 (system bus name :
Nov 12 20:59:28 localhost.localdomain setroubleshoot[53153]: SELinux is preventing /usr/libexec/mysqld from 'read, write' accesses on 
Nov 12 20:59:28 localhost.localdomain python[53153]: SELinux is preventing /usr/libexec/mysqld from 'read, write' accesses on the file
                                                     
                                                     *****  Plugin catchall (100. confidence) suggests   **************************
                                                     
                                                     If you believe that mysqld should be allowed read write access on the ibdata1 fil
                                                     Then you should report this as a bug.
                                                     You can generate a local policy module to allow this access.
                                                     Do
                                                     allow this access for now by executing:
                                                     # ausearch -c 'mysqld' --raw | audit2allow -M my-mysqld


selinux关闭:

 setenforce 0
vi /etc/selinux/config
#将SELINUX=enforcing改为SELINUX=disabled

六初始化MYSQL

报错

[root@localhost sql]# mysql -uroot
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111)

[root@localhost sql]# lsof -p 2490|grep sock
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
      Output information may be incomplete.
mysqld  2490 mysql   15u  unix 0xffff88005ff98800      0t0     32364 /tmp/mysql.sock
[root@localhost sql]# 

/etc/my.cf 配置了socket,且已经启动.

[root@localhost sql]# find / -name mysql.sock
find: ‘/run/user/1000/gvfs’: Permission denied
/tmp/systemd-private-c4fdd37f0cba48619d79162eadc6f013-mariadb.service-5vN2gw/tmp/mysql.sock
/tmp/mysql.sock

vim /etc/my.cnf
添加一个
[client]
socket=/tmp/systemd-private-c4fdd37f0cba48619d79162eadc6f013-mariadb.service-5vN2gw/tmp/mysql.sock

目前这样不知道什么原因,

七 安装依赖库

#安装yum epel 

yum install epel-release

yum -y install libpcap libpcap-devel libnet libnet-devel pcre pcre-devel gcc gcc-c++ automake autoconf libtool make libyaml libyaml-devel zlib zlib-devel file-devel

#md5 模块

yum install nss-util nss-util-devel nss-devel nspr-devel nspr
#安装依赖包

yum install cargo rustc

其他依赖库:

 yum install cracklib-devel
yum install jansson-devel
yum install libyaml-devel

八时区设置

 yum -y install ntp ntpdate
ntpdate cn.pool.ntp.org
hwclock --systohc
timedatectl set-timezone Asia/Shanghai 

九 netmap编译

pwd
/home/netmap-master/LINUX

 ./configure --kernel-sources=/usr/src/kernels/$(uname -r) --kernel-dir=/usr/src/kernels/$(uname -r) --prefix=/usr
make && make install

https://www.xamrdz.com/database/6g21875065.html

相关文章: