稍具规模一点的公司都会搭建属于自己的git,svn,而内部git用的最多的则是gitlab,虽然官网已经提供了非常多的功能,但内网搭建更能保证项目的私有性,只有公司内部员工才可以访问,更加安全。 这里演示gitlab的搭建与简单配置 操作 安装一些依赖软件包,SSH一般系统是默认安装好的,不过也不排除一些最小安装的系统没有sshd服务。
1 2 3 |
sudo yum install -y curl policycoreutils-python openssh-server sudo systemctl enable sshd sudo systemctl start sshd |
关闭防火墙,或者开放HTTP的端口
1 2 |
//刷新防火墙的规则 iptables -F |
安装邮件服务,当gitlab想要通过邮件通知,也可以另外配置其它的邮件服务器
1 2 3 |
sudo yum install postfix sudo systemctl enable postfix sudo systemctl start postfix |
从官网获取一件安装脚本,当然自己手动安装也是可以的gitlab下载地址,使用官网脚本会简单一些。执行这一步会如果使用CentOS系统,会添加gitlab的yum源
1 2 3 4 |
//输出到文件里是为了看下下载的脚本内容 curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh > rpm.sh chmod +x rpm.sh ./rpm.sh |
安装gitlab
1 2 3 4 |
//使用yum安装gitlab yum install -y gitlab-ee //可以看下gitlab-ee包的内容,看到gitlab安装在/opt/gitlab目录下 rpm -ql gitlab-ee | less |
上面已经安装好了gitlab,不过可以稍作一些配置,配置gitlab监听的地址与端口,gitlab的配置文件在/etc/gitlab/目录下,主要配置文件为gitlab.rb我修改了下gitlab.rb文件中的nginx监听地址,
1 2 3 4 |
external_url 'http://gitlab.ai-he.me' nginx['listen_addresses'] = ['0.0.0.0', '[::]'] # 系统端口冲突,我把端口改为了82 nginx['listen_port'] = 82 |
里面的配置项非常的多,可以对照官网文档根据需要修改。gitlab配置选项 运行gitlab命名,并重启
1 2 3 4 5 6 |
//重新配置gitlab sudo gitlab-ctl reconfigure //重启gitlab gitlab-ctl restart // 查看gitlab-ctl命令的帮助信息 gitlab-ctl --help |
打开浏览器查看效果,第一次打开页面会让我们设置root用户的密码。记住自己设置的密码,再次刷新进入登录页面 以管理员身份登录,默认的用户是root,密码是刚才设置的。 搭建好环境之后,下面的则根据官方文档解释,自己摸索做一些根据自己需要的修改,二次开发也可以。 最后 公司内部一般都会搭建内部gitlab仓库,自己搭建下摸索着玩玩。 参考 gitlab下载地址 gitlab配置选项 作者:Real_man 链接:https://www.jianshu.com/p/ade38a53b1ac 来源:简书 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
View DetailsCentOS 7 postfix启动报错: inet_interfaces: no local interface found for ::1 当前环境CentOS 7.4 [root@test ~]# cat /etc/redhat-release CentOS Linux release 7.4.1708 (Core) [root@test ~]# uname -r 3.10.0-693.2.2.el7.x86_64 使用systemctl start postfix时,总是提示: Job for postfix.service failed because the control process exited with error code. See “systemctl status postfix.service” and “journalctl -xe” for details. 重启也无效,查看日志more /var/log/maillog 或者 more /var/log/message 发现日志有报错信息: postfix: fatal: parameter inet_interfaces: no local interface found for ::1 重启服务器也没有解决 解决方法: vi /etc/postfix/main.cf 发现配置为: inet_interfaces = localhost inet_protocols = all 改成: inet_interfaces = all 或者 inet_interfaces = 127.0.0.1 inet_protocols = all […]
View Details一、引入starter
1 2 |
//热部署 compile("org.springframework.boot:spring-boot-devtools") |
二、开启自动编译 第一步
1 2 3 |
windows:ctrl + alt + shift + / mac: command + alt + shift + / |
弹出以下界面 第二步 点击Registry,勾选compiler.automake.allow.when.app.running 第三步 勾选 Make/Build project automatically 重新运行项目,随意改一个java类,看看项目是不是重启了^_^ from:https://blog.csdn.net/JonWu0102/article/details/81064776
View Details在引用依赖时经常会有这样的问题:某些间接引用的依赖项是不需要的;产生了依赖冲突。此时需要排除一些依赖。 下面的内容介绍了几种在gradle中排除依赖的方式。 在dependency中排除 1 2 3 4 5 6 7 8 dependencies { compile('com.zhyea:ar4j:1.0') { //excluding a particular transitive dependency: exclude module: 'cglib' //by artifact name exclude group: 'org.jmock' //by group exclude group: 'org.unwanted', module: 'iAmBuggy' //by both name and group } } 这种方式是粒度最细的,也是最为繁琐的。此时可以考虑全局设置。 在全局配置中排除 全局配置是在configuration中完成的。 1 2 3 4 configurations { compile.exclude module: 'cglib' all*.exclude group:’org.unwanted', module: 'iAmBuggy' } 禁用传递依赖 禁用传递依赖需要将属性transitive设置为false。可以在dependency中禁用传递依赖,也可以在configuration中全局禁用: 1 2 3 4 5 6 7 compile('com.zhyea:ar4j:1.0') { transitive = false } configurations.all { transitive = false } 还可以在单个依赖项中使用@jar标识符忽略传递依赖: […]
View Detailsspringboot 中默认的web容器是tomcat。 在maven 的pom 文件中加入如下依赖,便可使用tomcat 容器。
1 2 3 4 |
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> |
如果想使用 jetty 作为 web容器,需要2步操作: 1.排除默认的tomcat 容器
1 2 3 4 5 6 7 8 9 10 |
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </exclusion> </exclusions> </dependency> |
2.加入 jetty 的 starter 依赖
1 2 3 4 |
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jetty</artifactId> </dependency> |
from:https://www.cnblogs.com/appleat/p/9100822.html
View Details