Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Team5 Sports League application
Manage
Activity
Members
Labels
Plan
Issues
37
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Haoyu Sun
Team5 Sports League application
Commits
98a8af62
Commit
98a8af62
authored
1 month ago
by
Xiemuqing Xiao
Browse files
Options
Downloads
Patches
Plain Diff
Merge remote-tracking branch 'origin/main'
parent
0f0b9591
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Terraform/serverJenkins.sh
+115
-34
115 additions, 34 deletions
Terraform/serverJenkins.sh
with
115 additions
and
34 deletions
Terraform/serverJenkins.sh
+
115
−
34
View file @
98a8af62
#!/usr/bin/bash
echo
"update logging configuration..."
sudo
sh
-c
"echo '*.info;mail.none;authpriv.none;cron.none /dev/ttyS0' >> /etc/rsyslog.conf"
sudo
systemctl restart rsyslog
echo
"update logging configuration..."
echo
"cd to root directory..."
cd
root
echo
"whoami..."
su centos
cd
/home/centos
whoami
echo
logged
in
as
$USER
.
echo
in
directory
$PWD
echo
"pwd..."
pwd
# 安装常用工具
sudo
yum
install
wget
-y
sudo
yum
install
unzip
-y
sudo
yum
install
git
-y
#
commented out to speed things up, do not do this in production
#
echo "
upgrading
..."
#
sudo yum
upgrade -y
#
安装 OpenSSH
echo
"
Installing OpenSSH
..."
sudo
yum
install
-y
openssh-server
echo
"installing gfortran..."
sudo
yum
install
gcc-gfortran
-y
# 启动并启用 OpenSSH
echo
"Starting and enabling OpenSSH..."
sudo
systemctl start sshd
sudo
systemctl
enable
sshd
echo
"installing git..."
sudo
yum
install
git
-y
# 检查 OpenSSH 服务状态
sudo
systemctl status sshd
# 配置 GitLab 服务器 SSH 密钥
echo
"installing gitlab server key..."
touch
.ssh/known_hosts
ssh-keyscan git.cardiff.ac.uk
>>
.ssh/known_hosts
chmod
644 .ssh/known_hosts
sudo
apt-get update
sudo
apt-get
install
-y
openssh-server
sudo
systemctl start ssh
sudo
systemctl
enable
ssh
sudo touch
~/.ssh/known_hosts
sudo
ssh-keyscan gitlab.cs.cf.ac.uk
>>
~/.ssh/known_hosts
sudo chmod
644 ~/.ssh/known_hosts
# 配置用户 SSH 密钥
echo
"installing gitlab deployment key..."
touch
matrix_keypair.key
cat
<<
`
EOF
`
>>
matrix_keypair.key
...
...
@@ -67,18 +63,103 @@ vNfQn99+1/Zo5LdYEwAAABhJRCtzY21pbWNAV1JBODdFRUFCM0E0NkIB
`
EOF
`
chmod
400 matrix_keypair.key
# 通过 SSH 密钥克隆一个 Git 仓库
echo
"cloning repository..."
echo
$PWD
ssh-agent bash
-c
'ssh-add matrix_keypair.key; git clone git@git.cardiff.ac.uk:scmimc/matrix.git'
echo
"changing to repository directory..."
cd
matrix
# 更新 rsyslog 配置以将日志输出到特定设备
echo
"update logging configuration..."
sudo
sh
-c
"echo '*.info;mail.none;authpriv.none;cron.none /dev/ttyS0' >> /etc/rsyslog.conf"
sudo
systemctl restart rsyslog
# 确认当前的工作目录是否成功切换
cd
/home/rocky
echo
in
directory
$PWD
# 安装并配置 MariaDB 数据库
echo
"installing MariaDB..."
# sudo yum install mysql -y
sudo
dnf
install
mariadb-server
-y
sudo
systemctl start mariadb
sudo
systemctl status mariadb
sudo
systemctl
enable
mariadb
echo
"creating mysql_secure_installation.txt..."
touch
mysql_secure_installation.txt
cat
<<
`
EOF
`
>>
mysql_secure_installation.txt
n
Y
comsc
comsc
Y
Y
Y
Y
Y
`
EOF
`
echo
"running mysql_secure_installation..."
sudo
mysql_secure_installation < mysql_secure_installation.txt
sudo
yum
install
wget
-y
sudo
yum
install
unzip
-y
sudo
yum
install
git
-y
# 安装 Java 17
echo
"Installing Java 17..."
sudo
yum
install
java-17-openjdk-devel
-q
-y
echo
java
--version
# 安装 Jenkins
echo
"install Jenkins"
# https://pkg.jenkins.io/redhat-stable/
curl
--silent
--location
http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo |
sudo tee
/etc/yum.repos.d/jenkins.repo
sudo
rpm
--import
https://pkg.jenkins.io/redhat-stable/jenkins.io.key
sudo
rpm
--import
https://pkg.jenkins.io/redhat/jenkins.io-2023.key
sudo
dnf
install
https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
-y
sudo
yum
install
jenkins
-y
# 配置 Jenkins 的 SSH known_hosts 文件
echo
"installing gitlab server key... has to be added to the jenkins user home (~) dir "
mkdir
/var/lib/jenkins/.ssh
sudo touch
/var/lib/jenkins/.ssh/known_hosts
sudo
ssh-keyscan git.cardiff.ac.uk
>>
/var/lib/jenkins/.ssh/known_hosts
sudo chmod
644 /var/lib/jenkins/.ssh/known_hosts
# If you want jenkins on port 8081 so you can run your app on 8080 then change the default jenkins port.
#(look up linux sed - it is really cool)
# sudo sed -i 's/JENKINS_PORT="8080"/JENKINS_PORT="8081"/g' /etc/sysconfig/jenkins
sudo
systemctl start jenkins
systemctl status jenkins
sudo
systemctl
enable
jenkins
echo
"enabling execution..."
chmod
a+x
*
.sh
# echo "Installing Java 10..."
# curl -O https://download.java.net/java/GA/jdk10/10.0.2/19aef61b38124481863b1413dce1855f/13/GPL/openjdk-10.0.2_linux-x64_bin.tar.gz
# tar zxvf openjdk-10.0.2_linux-x64_bin.tar.gz
# sudo mv jdk-10.0.2 /usr/local/
# export JAVA_HOME=/usr/local/jdk-10.0.2
# export PATH=$PATH:$JAVA_HOME/bin
# java --version
# sudo ln -s /usr/local/jdk-10.0.2/bin/java /usr/bin/java
echo
"compiling matrix..."
./make.sh
# 安装 Gradle 7.6
echo
"Installing gradle..."
# wget https://services.gradle.org/distributions/gradle-6.7.1-bin.zip
wget https://services.gradle.org/distributions/gradle-7.6-bin.zip
sudo mkdir
/opt/gradle
# sudo unzip -d /opt/gradle gradle-6.7.1-bin.zip
# export PATH=$PATH:/opt/gradle/gradle-6.7.1/bin
sudo
unzip
-q
-d
/opt/gradle gradle-7.6-bin.zip
export
PATH
=
$PATH
:/opt/gradle/gradle-7.6/bin
echo
gradle
-v
echo
"running matrix..."
nohup
./run.sh &
# 安装 Terraform 1.1.5
echo
"Installing terraform..."
cd
/home/rocky
wget https://releases.hashicorp.com/terraform/1.1.5/terraform_1.1.5_linux_amd64.zip
unzip terraform_1.1.5_linux_amd64.zip
sudo mv
terraform /usr/local/bin/
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment