欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

centos - 初始化服务器环境

程序员文章站 2022-05-29 10:01:45
...
初始化服务器环境

包括
1. 安装wget
2. 安装vim
3. 安装jdk
4. 安装perl
前提准备,
1. 将建好目录/root/soft
2. 将jdk和perl的安装包上传到/root/soft目录下
jdkjdk-7u65-linux-i586.rpm
perl perl-5.16.1.tar.gz

脚本,/root/sbin/init_env.sh
yum install -y wget
echo "installed wget" >> /root/sbin/init_env.log
yum install -y vim 
echo "installed vim" >> /root/sbin/init_env.log
# install jdk
cd 
if [ ! -d "/root/soft" ];then
mkdir /root/soft
else
echo "/root/soft, this dir already exist."
fi
cd /root/soft
rpm -ivh jdk-7u65-linux-i586.rpm 
echo "export JAVA_HOME=/usr/java/latest" >> ~/.bashrc
echo "export PATH=$PATH:$JAVA_HOME/bin" >> ~/.bashrc
source .bashrc
echo "installed jdk" >> ~/sbin/init_env.log
# install perl
yum install -y gcc
cd /root/soft
tar -xzf perl-5.16.1.tar.gz
cd perl-5.16.1
./Configure -des -Dprefix=/usr/local/perl
make && make test && make install
echo "installed perl" >> ~/sbin/init_env.log

# test install
echo "test jdk install:" >> /root/sbin/init_env.log
java -version >> /root/sbin/init_env.log
echo "test perl install:" >> /root/sbin/init_env.log
perl -v >> /root/sbin/init_env.log

相关标签: yum