本文主要是介绍virtualbox上安装centos6.5以及安装Java,redis,hadoop等等常用开发工具,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
source /etc/profile配置文件生效
增强工具
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng
libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib
zlib-devel glibc glibc-devel
glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel
curl curl-devel vim ntsysvyum update kernelyum groupinstall "Development Tools"
安装java
检验系统原版本
[root@localhost ~]# java -version
java version "1.7.0_24"
OpenJDK Runtime Environment (build 1.7.0_24-b18)
OpenJDK HotSpot(TM) Client VM (build 24.45-b08, mixed mode, sharing)
进一步查看JDK信息:
[root@localhost ~]# rpm -qa | grep java
java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86_64
tzdata-java-2013g-1.el6.noarch
java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.x86_64
卸载OpenJDK,执行以下操作:
[root@localhost ~]# rpm -e --nodeps tzdata-java-2013g-1.el6.noarch
[root@localhost ~]# rpm -e --nodeps java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.x86_64
[root@localhost ~]#rpm -e --nodeps java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86_64sudo tar xvf jdk-7u79-linux-x64.tar.gz
sudo rm jdk-7u79-linux-x64.tar.gz
vi + /etc/profile
JAVA_HOME=/usr/local/java/jdk1.7.0_79
JRE_HOME=/usr/local/java/jdk1.7.0_79/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export JAVA_HOME JRE_HOME PATH CLASSPATH
注意:如果出现以下错误信息
bash: /usr/java/jdk1.7.0_04/lib/dt.jar: 权限不够
bash: /usr/java/jdk1.7.0_04/lib/tools.jar: 权限不够
错误原因:分隔符不能用;(分号),要用:(冒号)
安装tomcat
sudo tar -zxv -f apache-tomcat-7.0.64.tar.gz
sudo rm -rf apache-tomcat-7.0.64.tar.gzcd /etc/init.d
vi tomcat #!/bin/bash
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 234 20 80
JAVA_HOME=/usr/local/java/jdk1.7.0_79
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/usr/local/tomcat/apache-tomcat-7.0.64case $1 in
start)
sh $CATALINA_HOME/bin/startup.sh
;;
stop)
sh $CATALINA_HOME/bin/shutdown.sh
;;
restart)
sh $CATALINA_HOME/bin/shutdown.sh
sh $CATALINA_HOME/bin/startup.sh
;;
esac
exit 0chmod 755 tomcat
chkconfig --add tomcat
chkconfig --level 234 tomcat on
chkconfig --list tomcat
service tomcat start
service tomcat stop
service tomcat restart
more /usr/local/tomcat/apache-tomcat-7.0.64/logs/catalina.out
localhost:8080
Oracle Linux 自带了两个内核:一个是与 Red Hat 100% 兼容的,另一个是 Unbreakable Enterprise Kernel (UEK)。我的 Linux 来宾运行的是 UEK,因此需要安装相应的gcc 和 kernel-uek-devel 程序包,以便 Guest Additions 安装能够正常工作。这是因为 Guest Additions 安装需要构建和安装内核驱动程序。我使用了以下yum install 命令来下载和安装缺少的程序包:
# yum update# yum install gcc
# yum install kernel-uek-devel (yum output not shown)
安装httpd
yum install httpd
设置 Apache 在服务器启动时运行
chkconfig --levels 235 httpd on
service httpd start
安装mysql
yum -y install mysql-server
设置开机启动
chkconfig mysqld onservice mysqld start
设置MySQL的root用户设置密码
mysql -u root
mysql> set password for root@localhost=password('root');mysql -u root -p基本命令
show databases; //查看系统已存在的数据库
use databasesname; //选择需要使用的数据库
drop database databasename; //删除选定的数据库
exit //退出数据库的连接
create database test01; //建立名为test的数据库
show tables; // 列出当前数据库下的表
开放远程登录权限
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
FLUSH PRIVILEGES;
/etc/my.cnf 或 /etc/mysql/my.cnf 中的[mysqld]下面添加添加lower_case_table_names=1
lower_case_table_names=1;修改其大小写设置
hadoop安装
修改当前机器名称 /etc/sysconfig/network配置hosts文件
/etc/hostssudo tar xvf hadoop-1.2.1.tar.gz
sudo mv hadoop-1.2.1.tar.gz# set hadoop path
export HADOOP_HOME=/usr/local/hadoop/hadoop-1.2.1/
export PATH=$PATH:$HADOOP_HOME:$HADOOP_HOME/bin
export HADOOP_HOME_WARN_SUPPRESS=1配置hadoop-env.sh 位于conf目录
![这里写图片描述](https://img-blog.csdn.net/20160917192641048)配置core-site.xml文件
<configuration><property><name>hadoop.tmp.dir</name><value>/usr/local/hadoop/hadoop-1.2.1/tmp</value></property><property><name>fs.default.name</name><value>hdfs://master.hadoop:9000</value></property>
</configuration>配置hdfs-site.xml文件 configuration><property><name>dfs.replication</name><value>1</value>/property>
<configuration>配置mapred-site.xml文件 <configuration><property><name>mapred.job.tracker</name><value>http://master.hadoop:9001</value></property>
</configuration>配置masters文件
redis安装
wget http://download.redis.io/redis-stable.tar.gztar –zxvf redis-stable.tar.gzcd src
make installyum install tcl
make testredis-serverREDIS_HOME=/usr/local/redis/redis-stable
PATH=$PATH:$REDIS_HOME/src
export REDIS_HOMEcp redis.conf /etc/redis.conf
vim /etc/redis.confdaemonize yes
pidfile /usr/local/redis/redis-stable/pid/redis.pid
port 6379
tcp-backlog 511
timeout 600
tcp-keepalive 0
loglevel notice
logfile /usr/local/redis/redis-stable/log/redis.log
databases 16
save 900 1
save 300 10
save 60 10000
rdbcompression yes
dbfilename dump.rdb
dir /usr/local/redis/redis-stable/db
slave-serve-stale-data yes
appendonly yes
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
这篇关于virtualbox上安装centos6.5以及安装Java,redis,hadoop等等常用开发工具的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!