八、centos7安装mysql5.7-CSDN博客
基于八,克隆出一个新的虚拟机,用来安装制品库并配置mysql数据库。
比较官方的文章:
How to install JFrog Artifactory on CentOS 7 | CentLinux
仅参考,未使用(配置的centos自带的数据库,不会用)
目录
一、环境准备
1.查看jdk版本
2.查看mysql服务
3.安装jdk
二、安装artifactory并配置MySQL--失败
1.使用npm包--失败
2.使用tar.gz包--失败
设置环境变量
启动artifactory--浏览器无法访问
配置Mysql
三、安装PostgreSQL
一、环境准备
1.查看jdk版本
java -version 未找到java命令,说明未安装
2.查看mysql服务
sudo service mysqld status
sudo service mysqld start
本机mysql服务是启动的,sql yong也连接上了。
3.安装jdk
wget https://download.oracle.com/java/17/archive/jdk-17.0.6_linux-x64_bin.rpm
yum install -y jdk-17.0.6_linux-x64_bin.rpmjava -versioncd /usr/lib/jvm/jdkxxxx
二、安装artifactory并配置MySQL--失败
1.使用npm包--失败
之前下载了npm安装包:jfrog-artifactory-oss-7.90.8.rpm
放到虚拟机里,执行
sudo yum install jfrog-artifactory-oss-7.90.8.rpm -y
报错:
错误:软件包:jfrog-artifactory-oss-7.90.8-79008900.x86_64 (/jfrog-artifactory-oss-7.90.8)需要:libstdc++.so.6(CXXABI_1.3.9)(64bit)您可以尝试添加 --skip-broken 选项来解决该问题您可以尝试执行:rpm -Va --nofiles --nodigest
解决方法:
执行 yum repolist
[root@localhost ~]# yum repolist
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile* base: mirrors.tuna.tsinghua.edu.cn* extras: mirrors.tuna.tsinghua.edu.cn* updates: mirrors.tuna.tsinghua.edu.cn
源标识 源名称 状态
base/7/x86_64 CentOS-7 - Base 10,072
extras/7/x86_64 CentOS-7 - Extras 526
mysql-connectors-community/x86_64 MySQL Connectors Community 258
mysql-tools-community/x86_64 MySQL Tools Community 108
mysql57-community/x86_64 MySQL 5.7 Community Server 696
updates/7/x86_64 CentOS-7 - Updates 6,173
repolist: 17,833
[root@localhost ~]# yum provides libstdc++.so.6
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile* base: mirrors.tuna.tsinghua.edu.cn* extras: mirrors.tuna.tsinghua.edu.cn* updates: mirrors.tuna.tsinghua.edu.cn
libstdc++-4.8.5-44.el7.i686 : GNU Standard C++ Library
源 :base
匹配来源:
提供 :libstdc++.so.6
关闭了防火墙 systemctl stop firewalld
执行 sudo yum install -y libstdc++-4.8.5-44.el7.i686
之后继续安装artifactory,仍然报错。
2.使用tar.gz包--失败
提前下载了 jfrog-artifactory-oss-7.90.8-linux.tar.gz, 上传到虚拟机
tar -zxvf jfrog-artifactory-oss-7.90.8-linux.tar.gz -C /usr/local
cd /usr/local
ln -s /usr/local/artifactory-oss-7.90.8/ /usr/local/jfrog
ls -al /usr/local/jfrog/
安装后的目录只有app / var ,具体是干啥的没有搞明白,后面在研究
设置环境变量
# 编辑
sudo vim /etc/profile
或者用
vi /etc/profile# 添加
export ARTIFACTORY_HOME=/usr/local/jfrog# 生效
sudo source /etc/profile
或者用
. /etc/profile
启动artifactory--浏览器无法访问
(未启动时,var/log var/data var/backup var/etc/system.yml 都没有,要注意)
cd /usr/loca/jfrog/app/bin
./artifactoryctl start启动之后,var/logs之类的才会出来
但此时浏览器访问8081端口报404(此时防火墙已经关了,即使开了防火墙开放了8081端口,仍然是404。猜测是mysql未配置的原因)
配置Mysql
mysql -u root -p
因为artifactory区分大小写,所以创建一个区分大小写的数据库(使用utf8_bin区分大小写)
create database if not exists artifactory default character set utf8 collate utf8_bin;
之后 exit退出
cd /usr/local/jfrog/var/etc
vi system.yaml
artifactory运行内存配置
shared:## Java 17 distribution to use#javaHome: "JFROG_HOME/artifactory/app/third-party/java"## Extra Java options to pass to the JVM. These values add to or override the defaults.extraJavaOpts: "-Xms512m -Xmx2g"
extraJavaOpts原本是注释掉的,在运行时仍然会按照这个设置运行内存,可能在tomcat里设置了。这里我取消注释了。
配置数据库
database:type: mysqldriver: com.mysql.cj.jdbc.Driverurl: jdbc:mysql://127.0.0.1:3306/artifactory?useUnicode=true&useSSL=false&characterEncoding=UTF-8&rewriteBatchedStatements=true&allowMultiQueries=true&serverTimezone=UTCusername: <User name>password: <Password>
这个配置有两个问题
1.username后面是否需要空格
2.password是明文吗,有安全风险
安装mysql驱动
cd /usr/local/jfrog/app/artifactory
curl -O https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/8.2.0/mysql-connector-j-8.2.0.jar
启动artifactory
2024-09-01T08:18:49.539Z [shell] [WARN ] [] [installerCommon.sh:819 ] [main] - System.yaml validation failed
[WARN ] Error while initializing File resolver : yaml: line 68: could not find expected ':'
yaml文件,: 后面必须留空格,上面说的username留空格的问题解决了。
再次启动artifactory
访问浏览器报404,var/log下的日志提示
2024-09-01T08:25:54.730Z ^[[36m[jfrou]^[[0m ^[[34m[INFO ]^[[0m [1048b85c0cbc30ad] [security_keys.go:172 ] [main ] [] - Master key is missing. Pending for 115 seconds with 5m0s timeout
2024-09-01T08:25:55.071Z ^[[34;1m[jfmd ]^[[0m ^[[34m[INFO ]^[[0m [ ] [security_keys.go:172 ] [main ] - Master key is missing. Pending for 115 seconds with 2m0s timeout [init]
2024-09-01T08:25:55.400Z ^[[36;1m[jfevt]^[[0m ^[[34m[INFO ]^[[0m [5c060f643aa64c4d] [security_keys.go:172 ] [main ] [ ] - Master key is missing. Pending for 115 seconds with 2m0s timeout [startup]
2024-09-01T08:25:56.256Z ^[[[35[jfob ]^[[0m ^[[34m[INFO ]^[[0m [5f7d4d057d2fb922] [security_keys.go:172 ] [main ] - Master key is missing. Pending for 115 seconds with 2m0s timeout [startup]
2024-09-01T08:25:59.745Z ^[[36m[jfrou]^[[0m ^[[34m[INFO ]^[[0m [1048b85c0cbc30ad] [security_keys.go:172 ] [main ] [] - Master key is missing. Pending for 120 seconds with 5m0s timeout
2024-09-01T08:25:59.746Z ^[[34;1m[jfmd ]^[[0m ^[[31;1m[ERROR]^[[0m [ ] [keys.go:23 ] [main ] - Failed resolving master key: failed resolving 'shared.security.masterKey' key; file does not exist: /usr/local/jfrog/var/etc/security/master.key
goroutine 1 [running]:
runtime/debug.Stack()/src/runtime/debug/stack.go:24 +0x5e
jfrog.com/jfrog-go-commons/v7/pkg/log.(*standardLogger).Panicfc(0xc0004be150, {0x20da9f8, 0xc000989e30}, {0xc0003b2750, 0x90}, {0x0, 0x0, 0x0})goroot/pkg/mod/jfrog.com/jfrog-go-commons/v7@v7.111.0/pkg/log/standard_logger.go:98 +0xc6
jfrog.com/metadata/v7/services/common.MustResolveSecurityKeys({0x20da9f8, 0xc000989e30}, {0x20deea8, 0xc00093ceb0}, {0x20e92c8?, 0xc0004be150})jfrog.com/metadata/v7@v7.72.6/services/common/keys.go:23 +0x1c3
main.main()jfrog.com/metadata/v7@v7.72.6/metadata.go:35 +0x31d[init]
Caused by: org.jfrog.storage.dbtype.DbTypeNotAllowedException: DB Type mysql is not allowed: Cannot start the application with a database other than PostgreSQL. For more information, see JFrog documentation.
服了
6.x的版本,应该可以连接mysql。
以后看看,不搞一把,要不mysql白安装了。
三、安装PostgreSQL
单独写一章