centos7配置eclipse+maven+tomcat+mysql步骤

来源:互联网 发布:阿里云app名师课堂在哪 编辑:程序博客网 时间:2024/06/07 16:44
windows 和 linux 双系统安装
1.在windows7环境下利用u盘镜像安装
   a.在windows中利用分区工具,分出一个盘,让其变为未分配空间状态,准备用来将linux系统安装到此盘,不动windows的c盘
   b.利用u盘镜像进入到linux安装界面,选择安装存储介质时,选择安装的盘,选择之前分出来的为分配的磁盘空间,然后手动配置分区,添加linux的挂载区,"/",分配10GB左右,/home,分配20GB左右,/boot,分配200MB左右,/swap,分配大小一般为内存的两倍,设置好之后,就开始安装,等待安装完成
2.在linux中修改利用vim命令修改 /boot/grub2/grub.cfg文件,将windows7的系统引导添加到grub.cfg文件中
在##BEGIN /etc/grub.d/10_linux ##后面添加
menuenty 'win7_pro_x64'
{ set root=(hd0,1) chainloader +1}
编辑完之后保存退出,source /etc/profile 让文件立即生效,再次重启电脑就会有windows的引导了,
注意:不能用windows的pe工具修复windows引导,否则会将liunx的引导文件覆盖,在windows环境下添加linux引导比较麻烦


在linux中配置eclipse,tomcat,maven
1.将jdk压缩文件放入linux系统,利用tar命令解压文件
tar -xzvf jdk-8u151_linux_x64.tar.gz
2.配置jdk环境变量,vim修改/etc/profile文件,在文件结尾添加环境变量
export JAVA_HOME=/usr/jdk-8u151 //jdk的放置路径
export JAVA_BIN=/usr/jdk-8u151/bin //bin目录路径
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME JAVA_BIN PATH CLASSPATH
保存并退出,用sourse /etc/profile让修改的文件立即生效,用java命令验证jdk是否配置成功
2.将tomcat压缩文件放入linux系统,利用tar命令解压文件,在eclipse中配好tomcat
3.将maven压缩文件放入linux系统,利用tar命令解压文件,用vim修改/etc/profile文件,添加maven环境变量
在export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL后添加
export MAVEN_HOME=/opt/maven/apache-maven-3.5.2 //maven的放置路径
export PATH=$MAVEN_HOME/bin:$PATH
在eclipse中配置好maven
4.安装mysql步骤,解压安装包的方式安装
 a.将压缩包用tar命令解压
 b.groupadd mysql,添加Mysql用户组
 c.useradd -r -g root mysql,在用户组中添加用户
 d.改变数据库相关文件和目录的权限,授权给mysql用户组下的用户
chown -R mysql.mysql .
chown -R root .

 e.初始化数据库,首先保证/etc目录下没有my.cnf文件,如果有,用rm -rf删除文件
    初始化DB,在mysql安装目录下运行,scripts/mysql_install_db --user=mysql 
    随后出现下面的成功提示,在安装目录下复制my.cnf和mysql.server文件到指定目录
    cp support-files/my-medium.cnf /etc/my.cnf
    cp support-files/mysql.server /etc/init.d/mysql
   利用vim命令编辑/etc下的my.cnf文件,
# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock
default-character-set=utf8//设置mysql数据库的默认字符
# Here follows entries for some specific programs


# The MySQL server
[mysqld]
user =root
port = 3306
socket = /tmp/mysql.sock
basedir =/usr/mysql/mysql //设置mysql安装目录
datadir =/usr/mysql/mysql/data //设置mysql的data文件夹的存放位置
character_set_server=utf8//设置mysql数据库的默认字符
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!

#skip-networking

f.给用户赋予访问数据库文件权限
chown -R mysql data
  chgrp -R mysql .
 g.在安装目录下的bin目录下运行mysqlId_safe
./mysqlId_safe -user=root &
首次运行没有密码,通过navicat用户管理可以设置密码


数据库的一些常用命令
service mysql start//开启数据库
service mysql -u root -p shutdown //关闭数据库
service mysql restart //重启数据库
mysql -h -u -p//连接数据库
mysqladmin -u 用户名 -p 旧秘密 password 新密码 //修改密码


mysql安装成功后的提示信息:
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system


PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:


./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h localhost.localdomain password 'new-password'


Alternatively you can run:
./bin/mysql_secure_installation


which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.


See the manual for more instructions.


You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &


You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl


Please report any problems at http://bugs.mysql.com/




5.安装navicat数据库管理工具
将navicat的tar.gz压缩解压到指定文件夹,在解压的文件夹根目录下用./start_navicat运行软件,打开后如果是中文乱码
利用vim 编辑解压文件夹中的start_navicat文件,将export LANG="en_US.UTF-8"修改为zh_CN.UTF-8


其他linux环境问题:
1.系统中文设置,系统支持中文的情况下locale查看环境中的语言包,修改/etc/sysconfig/i18n文件,将en_us.UTF-8
改为zh_CN.UTF-8,保存退出即可
2.输入法设置:系统中有ibus输入法的情况下
在区域和语言设置中添加输入输入源汉语(INterlligent Pinyin)
3.查看系统用户组和密码,/etc/group  /etc/passwd




原创粉丝点击