释放双眼,带上耳机,听听看~!
在root用户下
1
2
3
4
5
6
7
8
9
10
11 1#!/bin/bash
2tar -zxvf jdk*
3cd jdk1*
4home=`pwd`
5echo $home
6echo "export JAVA_HOME=${home}" >> /etc/profile
7echo "export CLASSPATH=\$JAVA_HOME/lib" >> /etc/profile
8echo "export PATH=\$PATH:\$JAVA_HOME/bin" >> /etc/profile
9source /etc/profile
10
11
在普通用户下
1.登录root创建普通用户并修改参数
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 1#!/bin/bash
2user=haha
3groupadd ${user}
4useradd -g ${user} ${user} -m
5passwd ${user}
6chmod +w /etc/sudoers
7echo "${user} ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers
8chmod -w /etc/sudoers
9echo "* soft noproc 65535" >> /etc/security/limits.conf
10echo "* hard noproc 65535" >> /etc/security/limits.conf
11echo "* soft nofile 1000000" >> /etc/security/limits.conf
12echo "* hard nofile 1000000" >> /etc/security/limits.conf
13echo "sysctl -w fs.file-max =65536" >> /etc/security/limits.conf
14echo "ulimit -u 10000" >> /etc/profile
15source /etc/profile
16
17
2.登录创建的用户
1
2
3 1su 用户名
2
3
3.安装jdk脚本文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14 1#!/bin/bash
2tar -zxvf jdk*
3cd jdk1*
4home=`pwd`
5echo $home
6sudo sh -c "echo 'export JAVA_HOME=${home}' >> /etc/profile"
7sudo sh -c "echo 'export CLASSPATH=\$JAVA_HOME/lib' >> /etc/profile"
8sudo sh -c "echo 'export PATH=\$PATH:\$JAVA_HOME/bin' >> /etc/profile"
9
10source /etc/profile
11
12
13
14