首页 > 代码库 > centos安装maven,git,mysql

centos安装maven,git,mysql

安装maven
1:下载maven包:
http://mirror.bit.edu.cn/apache/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz

2,解压安装:
tar vxf apache-maven-3.5.0-bin.tar.gz -C /opt/

mv apache-maven-3.5.0-bin apache-maven-3.5.0

3,添加环境变量
MAVEN_HOME=/opt/apache-maven-3.5.0
export MAVEN_HOME
export PATH=${PATH}:${MAVEN_HOME}/bin

然后:
source /etc/profile

验证:
mvn -v

=============================================================
安装git 客户端
快速安装 yum install git

https://git-scm.com/download/linux
https://git-scm.com/book/zh/v1/%E8%B5%B7%E6%AD%A5-%E5%AE%89%E8%A3%85-Git

$ yum install curl-devel expat-devel gettext-devel \
openssl-devel zlib-devel

$ tar -zxf git-1.7.2.2.tar.gz
$ cd git-1.7.2.2
$ make prefix=/usr/local all
$ sudo make prefix=/usr/local install


=============================================================
安装 jenkins

官网分两种安装:一种是直接war包安装很简单;

第二种是安装包安装;

war 包安装 默认安装路径: /root/.jenkins

 第二种安装方式会在其他文章做详细介绍

 

=============================================================
安装 mysql
1.下载mysql的repo源

$ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

2.安装mysql-community-release-el7-5.noarch.rpm包

$ sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm

安装这个包后,会获得两个mysql的yum repo源:/etc/yum.repos.d/mysql-community.repo,/etc/yum.repos.d/mysql-community-source.repo。

3.安装mysql

$ sudo yum install mysql-server

根据提示安装就可以了,不过安装完成后没有密码,需要重置密码

4.重置mysql密码

$ mysql -u root

登录时有可能报这样的错:ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘ (2),原因是/var/lib/mysql的访问权限问题。下面的命令把/var/lib/mysql的拥有者改为当前用户:

$ sudo chown -R root:root /var/lib/mysql

重启mysql服务

$ service mysqld restart

接下来登录重置密码:

$ mysql -u root //直接回车进入mysql控制台
mysql > use mysql;
mysql > update user set password=password(‘123456‘) where user=‘root‘;
mysql > exit;


导入导出操作:
mysqldump -uroot -p123456 databse.table > xxx.file
mysqlimport -uroot -p123456 test xddd.file

mysql source xxx.sql 导入文件

centos安装maven,git,mysql