SIT Test DB server: [[email protected] ~]# uname -r 3.10.0-693.21.1.el7.x86_64 [[email protected] db_1]# cat /etc/redhat-release CentOS Linux release 7.4.1708 (Core) [[email protected] PSSDBbak]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 30G 20G 9.7G 68% / devtmpfs 28G 0 28G 0% /dev tmpfs 28G 6.9G 21G 25% /dev/shm tmpfs 28G 17M 28G 1% /run tmpfs 28G 0 28G 0% /sys/fs/cgroup /dev/sdc1 2.0T 455G 1.5T 24% /data /dev/sda1 497M 79M 419M 16% /boot tmpfs 5.6G 0 5.6G 0% /run/user/0 /dev/sdb1 111G 26G 80G 25% /mnt/resource tmpfs 5.6G 0 5.6G 0% /run/user/1001 /dev/loop0 4.3G 4.3G 0 100% /mnt/centos7 https://support.oracle.com/epmos/faces/CertifyResults?_adf.ctrl-state=12t9mjeyu2_9&searchCtx=st%255EANY%257Cpa%255Epi%255E564_Oracle%2BDatabase%257Evi%255E569%257Epli%255E35_Linux%2Bx86-64%257Eplvi%255E198%257Epln%255ELinux%2Bx86-64%2BRed%2BHat%2BEnterprise%2BLinux%2B5%257E%257C&_afrLoop=422537297086636 https://docs.oracle.com/cd/B19306_01/install.102/b15667.pdf 1.3 Shipped Kernels Oracle Linux 7 is shipped with the following kernels: • Red Hat Compatible Kernel (RHCK), based on mainline Linux version 3.10. • Unbreakable Enterprise Kernel Release 3 (UEK R3), starting with 3.8.13, based on mainline Linux version 3.8. This is the default kernel. http://download.oracle.com/otn/linux/oracle12c/121020/linuxamd64_12102_database_1of2.zip http://download.oracle.com/otn/linux/oracle12c/121020/linuxamd64_12102_database_2of2.zip [[email protected] oracle12c]# wget -b http://download.oracle.com/otn/linux/oracle12c/121020/linuxamd64_12102_database_1of2.zip Continuing in background, pid 102627. Output will be written to wget-log.1 [[email protected] oracle12c]# tail -f wget-log.1 Resolving login.oracle.com (login.oracle.com)... 209.17.4.8 Connecting to login.oracle.com (login.oracle.com)|209.17.4.8|:443... connected. HTTP request sent, awaiting response... 401 Authorization Required Authorization failed. wget --http-user= --http-password= -b http://download.oracle.com/otn/linux/oracle12c/121020/linuxamd64_12102_database_1of2.zip wget -O linuxamd64_12102_database_1of2.zip -b http://download.oracle.com/otn/linux/oracle12c/121020/linuxamd64_12102_database_1of2.zip?AuthParam=1525327359_595ffd13c451876a19e1015c48700706 wget -O linuxamd64_12102_database_2of2.zip -b http://download.oracle.com/otn/linux/oracle12c/121020/linuxamd64_12102_database_2of2.zip?AuthParam=1525327590_7f5e90233d2f3a45a7c45ecf6e711545 ------------------------------------------------------------------------------- after downloaded, try to install oracle12c -------------------steps below begin-------------------------- step1:Check Hardware Requirements [[email protected] oracle12c]# ls -ll total 2629112 -rw-r--r--. 1 root root 178 May 3 05:24 filelist.txt -rw-r--r--. 1 root root 1673544724 Jul 11 2014 linuxamd64_12102_database_1of2.zip -rw-r--r--. 1 root root 1014530602 Jul 11 2014 linuxamd64_12102_database_2of2.zip -rw-r--r--. 1 root root 5162 May 3 05:53 wget-log -rw-r--r--. 1 root root 2328 May 3 05:19 wget-log.1 -rw-r--r--. 1 root root 2436 May 3 05:56 wget-log.2 -rw-r--r--. 1 root root 2567209 May 3 06:06 wget-log.3 -rw-r--r--. 1 root root 1539673 May 3 06:08 wget-log.4 [[email protected] oracle12c]# grep "model name" /proc/cpuinfo model name : Intel(R) Xeon(R) CPU E5-2660 0 @ 2.20GHz model name : Intel(R) Xeon(R) CPU E5-2660 0 @ 2.20GHz model name : Intel(R) Xeon(R) CPU E5-2660 0 @ 2.20GHz model name : Intel(R) Xeon(R) CPU E5-2660 0 @ 2.20GHz model name : Intel(R) Xeon(R) CPU E5-2660 0 @ 2.20GHz model name : Intel(R) Xeon(R) CPU E5-2660 0 @ 2.20GHz model name : Intel(R) Xeon(R) CPU E5-2660 0 @ 2.20GHz model name : Intel(R) Xeon(R) CPU E5-2660 0 @ 2.20GHz [[email protected] oracle12c]# cat /proc/cpuinfo | grep "processor" | wc -l 8 [[email protected] oracle12c]# cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l 1 [[email protected] oracle12c]# cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l 1 [[email protected] oracle12c]# grep MemTotal /proc/meminfo MemTotal: 57703176 kB [[email protected] oracle12c]# topas -bash: topas: command not found [[email protected] oracle12c]# top top - 07:29:24 up 8 days, 6:21, 2 users, load average: 0.00, 0.01, 0.05 Tasks: 154 total, 1 running, 153 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.3 us, 0.1 sy, 0.0 ni, 99.5 id, 0.0 wa, 0.0 hi, 0.1 si, 0.0 st KiB Mem : 57703176 total, 23158080 free, 522856 used, 34022240 buff/cache KiB Swap: 0 total, 0 free, 0 used. 56143428 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1035 root 20 0 382816 18916 5384 S 2.3 0.0 162:04.07 python 106042 root 20 0 0 0 0 S 0.5 0.0 0:00.05 kworker/0:1 106115 root 20 0 157716 2216 1540 R 0.5 0.0 0:00.05 top 1 root 20 0 193836 6976 4064 S 0.0 0.0 0:38.22 systemd 2 root 20 0 0 0 0 S 0.0 0.0 0:00.24 kthreadd 3 root 20 0 0 0 0 S 0.0 0.0 0:00.27 ksoftirqd/0 5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H 7 root rt 0 0 0 0 S 0.0 0.0 0:03.50 migration/0 8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh 9 root 20 0 0 0 0 S 0.0 0.0 2:02.25 rcu_sched 10 root rt 0 0 0 0 S 0.0 0.0 0:06.06 watchdog/0 11 root rt 0 0 0 0 S 0.0 0.0 0:04.67 watchdog/1 12 root rt 0 0 0 0 S 0.0 0.0 0:02.36 migration/1 13 root 20 0 0 0 0 S 0.0 0.0 0:03.52 ksoftirqd/1 15 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/1:0H 16 root rt 0 0 0 0 S 0.0 0.0 0:04.60 watchdog/2 [[email protected] oracle12c]# grep SwapTotal /proc/meminfo SwapTotal: 0 kB [[email protected] oracle12c]# free -g total used free shared buff/cache available Mem: 55 0 22 0 32 53 Swap: 0 0 0 [[email protected] oracle12c]# [[email protected] oracle12c]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 30G 6.3G 24G 22% / devtmpfs 28G 0 28G 0% /dev tmpfs 28G 0 28G 0% /dev/shm tmpfs 28G 465M 28G 2% /run tmpfs 28G 0 28G 0% /sys/fs/cgroup /dev/sdc1 2.0T 26G 1.9T 2% /data /dev/sda1 497M 79M 419M 16% /boot /dev/sdb1 111G 85M 105G 1% /mnt/resource tmpfs 5.6G 0 5.6G 0% /run/user/0 [[email protected] oracle12c]# uname -m x86_64 [[email protected] oracle12c]# uname -r 3.10.0-693.21.1.el7.x86_64 [[email protected] oracle12c]# more /etc/redhat-release CentOS Linux release 7.4.1708 (Core) [[email protected] oracle12c]# uname -a Linux pss-db-test 3.10.0-693.21.1.el7.x86_64 #1 SMP Wed Mar 7 19:03:37 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux 安装oracle-database-server-12cR2-preinstall wget http://public-yum.oracle.com/public-yum-ol7.repo -O /etc/yum.repos.d/public-yum-ol7.repo wget http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol7 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle yum clean all yum update yum install oracle-database-server-12cR2-preinstall -y yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*.i686 elfutils-libelf-devel gcc gcc-c++ glibc*.i686 glibc glibc-devel glibc-devel*.i686 ksh libgcc*.i686 libgcc libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.i686 libaio libaio*.i686 libaio-devel libaio-devel*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686 libXp yum install -y binutils.x86_64 compat-libcap1.x86_64 gcc.x86_64 gcc-c++.x86_64 glibc.i686 glibc.x86_64 glibc-devel.i686 glibc-devel.x86_64 ksh compat-libstdc++-33 libaio.i686 libaio.x86_64 libaio-devel.i686 libaio-devel.x86_64 libgcc.i686 libgcc.x86_64 libstdc++.i686 libstdc++.x86_64 libstdc++-devel.i686 libstdc++-devel.x86_64 libXi.i686 libXi.x86_64 libXtst.i686 libXtst.x86_64 make.x86_64 sysstat.x86_64 libXtst.i686 libXtst.x86_64 make.x86_64 sysstat.x86_64 step2:系统配置准备 2.1 create group and user [[email protected] oracle12c]# groupadd dba [[email protected] oracle12c]# groupadd oinstall [[email protected] oracle12c]# useradd -g oinstall -G dba oracle [[email protected] oracle12c]# id oracle uid=1001(oracle) gid=1002(oinstall) groups=1002(oinstall),1001(dba) [[email protected] oracle12c]# passwd oracle 2.2 create directory [[email protected] oracle12c]# mkdir -p /u01/app/oracle [[email protected] oracle12c]# chown -R oracle:oinstall /u01/app/oracle [[email protected] oracle12c]# chmod -R 775 /u01/app/oracle [[email protected] oracle12c]# mkdir -p /u01/app/oracle/product/12.1.0/db_1 mkdir -p /u01/app/oraInventory chown -R oracle:oinstall /u01/app/oraInventory chmod -R 775 /u01/app/oraInventory mkdir -p /etc/oracle chmod -R 775 /etc/oracle 2.3 Disable SELinux sed -i s#SELINUX=enforcing#SELINUX=disabled#g /etc/selinux/config setenforce 0 egrep "SELINUX=disabled" /etc/selinux/config getenforcesystemctl stop firewalld.service #关闭OEL7默认防火墙 systemctl disable firewalld.service --- [[email protected] os]# /usr/sbin/sestatus SELinux status: disabled [[email protected] os]# /usr/sbin/getenforce Disabled [[email protected] os]# Disable secure linux by editing the "/etc/selinux/config" file, making sure the SELINUX flag is set as follows. SELINUX=disabled 2.4 change system kernel parameters [[email protected] oracle12c]# sysctl -a | grep shm kernel.shm_next_id = -1 kernel.shm_rmid_forced = 0 kernel.shmall = 18446744073692774399 kernel.shmmax = 18446744073692774399 kernel.shmmni = 4096 sysctl: reading key "net.ipv6.conf.all.stable_secret" sysctl: reading key "net.ipv6.conf.default.stable_secret" sysctl: reading key "net.ipv6.conf.eth0.stable_secret" sysctl: reading key "net.ipv6.conf.lo.stable_secret" vm.hugetlb_shm_group = 0 [[email protected] oracle12c]# getconf PAGESIZE 4096 [[email protected] oracle12c]# sysctl -a | grep sem kernel.sem = 250 32000 32 128 kernel.sem_next_id = -1 sysctl: reading key "net.ipv6.conf.all.stable_secret" sysctl: reading key "net.ipv6.conf.default.stable_secret" sysctl: reading key "net.ipv6.conf.eth0.stable_secret" sysctl: reading key "net.ipv6.conf.lo.stable_secret" [[email protected] oracle12c]# sysctl -a | grep file-max fs.file-max = 5717204 sysctl: reading key "net.ipv6.conf.all.stable_secret" sysctl: reading key "net.ipv6.conf.default.stable_secret" sysctl: reading key "net.ipv6.conf.eth0.stable_secret" sysctl: reading key "net.ipv6.conf.lo.stable_secret" [[email protected] oracle12c]# sysctl -a | grep ip_local_port_range net.ipv4.ip_local_port_range = 32768 60999 sysctl: reading key "net.ipv6.conf.all.stable_secret" sysctl: reading key "net.ipv6.conf.default.stable_secret" sysctl: reading key "net.ipv6.conf.eth0.stable_secret" sysctl: reading key "net.ipv6.conf.lo.stable_secret" [[email protected] oracle12c]# [[email protected] etc]# vi /etc/sysctl.conf # sysctl settings are defined through files in # /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/. # # Vendors settings live in /usr/lib/sysctl.d/. # To override a whole file, create a new file with the same in # /etc/sysctl.d/ and put new settings there. To override # only specific settings, add a file with a lexically later # name in /etc/sysctl.d/ and put new settings there. # # For more information, see sysctl.conf(5) and sysctl.d(5). kernel.shmmax = 68719476736 kernel.shmall = 6029312 kernel.shmmni = 4096 kernel.sem =250 32000 100 128 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 262144 net.ipv4.ip_local_port_range =9000 65500 fs.file-max=65536 fs.aio-max-nr=1048576 "sysctl.conf" 32L, 761C written [[email protected] etc]# sysctl -p kernel.shmmax = 68719476736 kernel.shmall = 6029312 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 262144 net.ipv4.ip_local_port_range = 9000 65500 fs.file-max = 65536 fs.aio-max-nr = 1048576 [[email protected] etc]# 2.5 user limits settings 在/etc/security/limits.conf中添加如下配置。 oracle soft nproc 4096 oracle hard nproc 16384 oracle soft nofile 10240 oracle hard nofile 65536 oracle soft stack 10240 oracle hard stack 10240 Add the following line to the "/etc/pam.d/login" file, if it does not already exist. session required /lib/security/pam_limits.so session required pam_limits.so Add the following to /etc/profile if Oracle user will use the bash shell. if [ $USER = "oracle" ]; then ulimit -u 16384 ulimit -n 65536 fi 2.6 config enviroment variables 首先切换到oracle账户 ,编辑修改主目录下 .bash_profile TMP=/tmp; export TMP TMPDIR=$TMP; export TMPDIR ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1; export ORACLE_HOME ORACLE_SID=auchan; export ORACLE_SID ORACLE_TERM=xterm; export ORACLE_TERM PATH=/usr/sbin:$PATH; export PATH PATH=$ORACLE_HOME/bin:$PATH; export PATH LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH 使配置生效 [[email protected] ~]$ source .bash_profile [[email protected] ~]$ root: xhost + oracle:export DISPLAY=172.16.0.6:0.0 [[email protected] database]$ export DISPLAY=172.16.0.6:0.0 [[email protected] database]$ ./runInstaller Starting Oracle Universal Installer... Checking Temp space: must be greater than 500 MB. Actual 17469 MB Passed Checking swap space: 0 MB available, 150 MB required. Failed <<<< Checking monitor: must be configured to display at least 256 colors >>> Could not execute auto check for display colors using command /usr/bin/x<<<< Some requirement checks failed. You must fulfill these requirements before continuing with the installation, Continue? (y/n) [n] y >>> Ignoring required pre-requisite failures. Continuing... Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-05-03_10xception in thread "main" java.lang.NoClassDefFoundError: Could not initialize c $sudo yum install java-1.8.0-openjdk [[email protected] ~]$./runInstaller -silent -responseFile /oracle12c/database/db_install.rsp [[email protected] ~]$tail -f -n 10 /tmp/OraInstall2018-05-03_11-05-43AM/installActions2018-05-03_11-05-43AM.log [[email protected] database]$ ./runInstaller -silent -responseFile /oracle12c/database/db_install.rsp Starting Oracle Universal Installer... Checking Temp space: must be greater than 500 MB. Actual 13840 MB Passed Checking swap space: must be greater than 150 MB. Actual 1023 MB Passed Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-05-04_03-46-03AM. Please wait ...[[email protected] database]$ [WARNING] [INS-13014] Target environment does not meet some optional requirements. CAUSE: Some of the optional prerequisites are not met. See logs for details. /tmp/OraInstall2018-05-04_03-46-03AM/installActions2018-05-04_03-46-03AM.log ACTION: Identify the list of failed prerequisite checks from the log: /tmp/OraInstall2018-05-04_03-46-03AM/installActions2018-05-04_03-46-03AM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually. You can find the log of this install session at: /u01/app/oraInventory/logs/installActions2018-05-04_03-46-03AM.log The installation of Oracle Database 12c was successful. Please check ‘/u01/app/oraInventory/logs/silentInstall2018-05-04_03-46-03AM.log‘ for more details. As a root user, execute the following script(s): 1. /u01/app/oraInventory/orainstRoot.sh 2. /u01/app/oracle/product/12.1.0/db_1/root.sh Successfully Setup Software. [[email protected] database]$ netca -silent -responseFile /oracle12c/database/netca.rsp UnsatisfiedLinkError exception loading native library: njni12 java.lang.UnsatisfiedLinkError: /u01/app/oracle/product/12.1.0/db_1/lib/libnjni12.so: /u01/app/oracle/product/12.1.0/db_1/lib/libclntsh.so.12.1: file too short java.lang.UnsatisfiedLinkError: oracle.net.common.NetGetEnv.jniGetOracleHome()Ljava/lang/String; at oracle.net.common.NetGetEnv.jniGetOracleHome(Native Method) at oracle.net.common.NetGetEnv.getOracleHome(Unknown Source) at oracle.net.ca.NetCALogger.getOracleHome(NetCALogger.java:230) at oracle.net.ca.NetCALogger.initOracleParameters(NetCALogger.java:215) at oracle.net.ca.NetCALogger.initLogger(NetCALogger.java:130) at oracle.net.ca.NetCA.main(NetCA.java:433) Error: oracle.net.common.NetGetEnv.jniGetOracleHome()Ljava/lang/String; Oracle Net Services configuration failed. The exit code is 1 [[email protected] database]$ rpm -qa|grep glibc-* glibc-headers-2.17-222.el7.x86_64 glibc-common-2.17-222.el7.x86_64 glibc-2.17-222.el7.i686 glibc-devel-2.17-222.el7.i686 glibc-devel-2.17-222.el7.x86_64 glibc-2.17-222.el7.x86_64 [[email protected] database]$ cd $ORACLE_HOME [[email protected] db_1]$ cd bin/ [[email protected] bin]$ relink all writing relink log to: /u01/app/oracle/product/12.1.0/db_1/install/relink.log [[email protected] bin]$ vi /u01/app/oracle/product/12.1.0/db_1/install/relink.log [[email protected] bin]$ netca -silent -responseFile /oracle12c/database/netca.rsp Parsing command line arguments: Parameter "silent" = true Parameter "responsefile" = /oracle12c/database/netca.rsp Done parsing command line arguments. Oracle Net Services Configuration: Profile configuration complete. PRCR-1164 : Failed to flush an output stream Oracle Net Listener Startup: The information provided for this listener is currently in use by other software on this computer. Listener start failed. Check the trace file for details: /u01/app/oracle/cfgtoollogs/netca/trace_OraDB12Home1-1805046AM2521.log Oracle Net Services configuration failed. The exit code is 1 [[email protected] etc]# chmod -R 775 /etc/oracle [[email protected] etc]# [[email protected] database]$ netca -silent -responseFile /oracle12c/database/netca.rsp Parsing command line arguments: Parameter "silent" = true Parameter "responsefile" = /oracle12c/database/netca.rsp Done parsing command line arguments. Oracle Net Services Configuration: Profile configuration complete. Listener "LISTENER" already exists. Oracle Net Services configuration successful. The exit code is 0 [[email protected] database]$ dbca -silent -responseFile /oracle12c/database/dbca.rsp -sysPassword auchan -systemPassword auchan [[email protected] database]$ dbca -silent -responseFile /oracle12c/database/dbca.rsp -sysPassword auchan -systemPassword auchan Cleaning up failed steps 5% complete Copying database files 7% complete 8% complete 9% complete DBCA Operation failed. Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/auchan/auchan0.log" for further details. Database Configuration Assistant failed to detect options for this Oracle Installation. ORA-12547: TNS:lost contact Due to this failure some Database Configuration Assistant features will not be available. Do you want to continue? Unique database identifier check passed. / has enough space. Required space is 6140 MB , available space is 12116 MB. File Validations Successful. Cleaning up failed steps DBCA_PROGRESS : 5% Copying database files DBCA_PROGRESS : 7% DBCA_PROGRESS : 8% ORA-12547: TNS:lost contact DBCA_PROGRESS : 9% Error while cataloging RMAN Backups DBCA_PROGRESS : DBCA Operation failed. ---图形界面方式 [[email protected] ~]# ssh -X [email protected] Password: Last login: Fri May 4 12:30:12 2018 /usr/bin/xauth: file /home/oracle/.Xauthority does not exist [[email protected] ~]$ cd /oracle12c/database/ [[email protected] database]$ ./runInstaller Starting Oracle Universal Installer... Checking Temp space: must be greater than 500 MB. Actual 12116 MB Passed Checking swap space: must be greater than 150 MB. Actual 1023 MB Passed Checking monitor: must be configured to display at least 256 colors >>> Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPLAY variable is set. Failed <<<< Some requirement checks failed. You must fulfill these requirements before continuing with the installation, Continue? (y/n) [n] y >>> Ignoring required pre-requisite failures. Continuing... Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-05-04_12-31-21PM. Please wait ... [[email protected] database]$ ----------------------------------centos7 download---------------------------------------------------------------------------------------------- wget -b http://mirrors.cqu.edu.cn/CentOS/7/isos/x86_64/CentOS-7-x86_64-DVD-1708.iso [[email protected] OS]# wget -b http://mirrors.cqu.edu.cn/CentOS/7/isos/x86_64/CentOS-7-x86_64-Everything-1708.iso Continuing in background, pid 70648. Output will be written to ‘wget-log.1’. [[email protected] OS]# tail -f wget-log.1 mkdir /mnt/centos7 [[email protected] resource]# umount /mnt/centos7 [[email protected] resource]# mount /mnt/resource/CentOS-7-x86_64-DVD-1708.iso /mnt/centos7 -o loop [[email protected] OS]# mount /oracle12c/OS/CentOS-7-x86_64-DVD-1708.iso /mnt/centos7 -o loop mount: /dev/loop0 is write-protected, mounting read-only [[email protected] OS]# cd /mnt/centos7/ [[email protected] centos7]# ls CentOS_BuildTag EULA images LiveOS repodata RPM-GPG-KEY-CentOS-Testing-7 EFI GPL isolinux Packages RPM-GPG-KEY-CentOS-7 TRANS.TBL [[email protected] centos7]# ---add swap to 16G dd if=/dev/zero of=/mnt/resource/swapfile bs=1M count=16384 mkswap /mnt/resource/swapfile swapon /mnt/resource/swapfile 编辑/etc/fstab,加入下面一行 /mnt/resource/swapfile swap swap defaults 0 0 [[email protected] home]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 30G 14G 17G 45% / devtmpfs 28G 0 28G 0% /dev tmpfs 28G 0 28G 0% /dev/shm tmpfs 28G 8.6M 28G 1% /run tmpfs 28G 0 28G 0% /sys/fs/cgroup /dev/sdc1 2.0T 402G 1.5T 21% /data /dev/sda1 497M 79M 419M 16% /boot tmpfs 5.6G 0 5.6G 0% /run/user/0 /dev/sdb1 111G 9.3G 96G 9% /mnt/resource tmpfs 5.6G 0 5.6G 0% /run/user/1001 [[email protected] home]# dd if=/dev/zero of=/mnt/resource/swapfile bs=1M count=16384 16384+0 records in 16384+0 records out 17179869184 bytes (17 GB) copied, 20.2168 s, 850 MB/s [[email protected] home]# mkswap /mnt/resource/swapfile Setting up swapspace version 1, size = 16777212 KiB no label, UUID=71607810-6c2b-498c-99e1-d8a5592d6bc7 [[email protected] home]# swapon /mnt/resource/swapfile swapon: /mnt/resource/swapfile: insecure permissions 0644, 0600 suggested. [[email protected] home]# vi /etc/fstab [[email protected] home]#
原文地址:https://www.cnblogs.com/ayumie/p/8996096.html
时间: 2024-11-02 21:11:07