虚拟机安装

openGauss3.0安装前主机初始化_vmware

openGauss3.0安装前主机初始化_sed_02

openGauss3.0安装前主机初始化_vmware_03

准备文件系统


LVM


pvcreate /dev/sdb

vgcreate datavg /dev/sdb

lvcreate -n datalv -L 200000M datavg

mkfs.xfs /dev/datavg/datalv

cat >> /etc/fstab  << EOF

/dev/datavg/datalv     /opengauss              xfs     defaults,noatime,nodiratime,nobarrier 0 0

EOF

cat /etc/fstab

10.

mkdir /opengauss

mount /opengauss

mkdir -p /opengauss/{opengaussdb,archive,scripts,backup,soft}

:::

创建用户



groupadd opengauss

useradd -g opengauss -d /home/opengauss -m -s /bin/bash opengauss

echo "opengauss" |passwd --stdin opengauss

chown -R opengauss:opengauss /opengauss

su - opengauss

vi ~/.bash_profile  

su - opengauss

vi ~/.bash_profile 

export LANG=en_US.UTF8

export PS1="[​​whoami​​​@​​hostname​​:"'$PWD]$'

export GAUSSHOME=/opengauss/opengaussdb/app

export LD_LIBRARY_PATH=/opengauss/opengaussdb/app/lib

export PATH=/opengauss/opengaussdb/app/bin:$PATH:$HOME/.local/bin:$HOME/bin

exit

source ~/.bash_profile 

:::

修改主机参数


#修改启动级别

systemctl set-default multi-user.target

#修改/etc/security/limits.conf

cat >> /etc/security/limits.conf << EOF

  • soft nproc 65535
  • hard nproc 65535
  • soft nofile 65535
  • hard nofile 65535
  • soft stack 65535
  • hard stack 65535
  • hard memlock unlimited
  • soft memlock unlimited


EOF

cat /etc/security/limits.conf

#修改 /etc/sysctl.conf

echo "vm.swappiness=1" >> /etc/sysctl.conf

echo "fs.aio-max-nr = 1048576" >> /etc/sysctl.conf

echo "fs.file-max = 6815744" >> /etc/sysctl.conf

echo "net.ipv4.tcp_retries1=5" >> /etc/sysctl.conf

echo "net.ipv4.tcp_syn_retries=5" >> /etc/sysctl.conf

echo "net.ipv4.tcp_synack_retries=5" >> /etc/sysctl.conf

echo "net.ipv4.tcp_retries2=12" >> /etc/sysctl.conf

echo "net.ipv4.ip_local_port_range=26000 65535" >> /etc/sysctl.conf

echo "vm.min_free_kbytes=512000" >> /etc/sysctl.conf

echo "net.ipv4.tcp_fin_timeout=60" >> /etc/sysctl.conf

echo "net.ipv4.tcp_sack=1" >> /etc/sysctl.conf

echo "net.ipv4.tcp_timestamps=1" >> /etc/sysctl.conf

echo "vm.extfrag_threshold=500" >> /etc/sysctl.conf

echo "vm.overcommit_ratio=90" >> /etc/sysctl.conf

echo "kernel.sem = 250 32000 100 999" >> /etc/sysctl.conf

sysctl -p

#修改/etc/security/limits.d/20-nproc.conf

sed -i 's/4096/65535/g' /etc/security/limits.d/20-nproc.conf

:::

#设置时区

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

hwclock

#禁用selinux

sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

setenforce 0

#关闭防火墙

systemctl disable firewalld.service

systemctl stop firewalld.service

#关闭透明大页

cp /etc/default/grub /etc/default/grub_bak

line_num=​​cat -n /etc/default/grub | grep 'GRUB_CMDLINE_LINUX' |awk '{print $1}'|head -n 1​​sed -i --follow-symlinks 's/transparent_hugepage=never//g' /etc/default/grub

sed -i --follow-symlinks ""${line_num}" s/\"$/ transparent_hugepage=never\"/g" /etc/default/grub

#生效grub配置

grub2-mkconfig -o /boot/grub2/grub.cfg

#禁用RemoveIPC

sed -i '/^RemoveIPC/d' /etc/systemd/logind.conf

sed -i '/^RemoveIPC/d' /usr/lib/systemd/system/systemd-logind.service

echo "RemoveIPC=no" >> /etc/systemd/logind.conf

echo "RemoveIPC=no" >> /usr/lib/systemd/system/systemd-logind.service

systemctl daemon-reload

systemctl restart systemd-logind

loginctl show-session | grep RemoveIPC

systemctl show systemd-logind | grep RemoveIPC

#配置yum源并安装依赖

mount /dev/cdrom /mnt

cd /etc/yum.repos.d

mkdir bk

mv *.repo bk/

echo "[EL7-1]" > /etc/yum.repos.d/itpux.repo

echo "name =Linux-7" >> /etc/yum.repos.d/itpux.repo

echo "baseurl=file:///mnt" >> /etc/yum.repos.d/itpux.repo

echo "gpgcheck=0" >> /etc/yum.repos.d/itpux.repo

echo "enabled=1" >> /etc/yum.repos.d/itpux.repo

yum install -y libaio-devel libnsl flex bison ncurses-devel glibc-devel patch readline-devel

yum install -y net-tools tar bzip2 python3 cmake make gcc zlib gcc-c++ perl zlib-devel tcl openssl openldap pam

:::

克隆三个虚拟机备用


opengauss01、opengauss02、opengauss03

192.168.75.61、192.168.75.62、192.168.75.63

openGauss3.0安装前主机初始化_bash_04

openGauss3.0安装前主机初始化_sed_05

openGauss3.0安装前主机初始化_opengauss_06

分别修改3台主机的IP地址和MAC地址

openGauss3.0安装前主机初始化_linux_07

vim /etc/sysconfig/network-scripts/ifcfg-ens33

openGauss3.0安装前主机初始化_sed_08

#修改hostname

hostnamectl --static set-hostname opengauss01

#修改/etc/hosts

echo "127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4"> /etc/hosts

echo "::1 localhost localhost.localdomain localhost6 localhost6.localdomain6">> /etc/hosts

echo "192.168.75.61 opengauss01">> /etc/hosts

echo "192.168.75.62 opengauss02">> /etc/hosts

echo "192.168.75.63 opengauss03">> /etc/hosts

cat /etc/hosts

其他主机修改方法相同

:::