Skip to content

Commit 428f3e9

Browse files
authored
updated to full unattended installation
1 parent 424100a commit 428f3e9

File tree

1 file changed

+38
-41
lines changed

1 file changed

+38
-41
lines changed

install-confluence.sh

Lines changed: 38 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,37 @@
11
#!/bin/bash
2-
32
#Colours
43
#RED="\033[31m"
54
#GREEN="\033[32m"
65
#BLUE="\033[34m"
76
#RESET="\033[0m"
87

98
#####################################################################
10-
# Get the inputs from user #
9+
# Custom answers #
1110
#####################################################################
12-
read -p "Enter the confluence user name you want to create(confluence_user): " confluence_user
13-
confluence_user=${confluence_user:-confluence_user}
14-
read -sp "Enter the new confluence user password: " confluence_usr_pwd
15-
echo
16-
read -p "Enter the confluence database you want to create (confluence_db): " confluence_db
17-
confluence_db=${confluence_db:-confluence_db}
11+
#update the answers below as per your requirements
12+
# database name, user and password that Confluence will use
13+
confluence_user=confluence_user
14+
confluence_usr_pwd=ch@ngeTH!s
15+
confluence_db=confluence_db
1816

1917
#copy your ssl certificates
20-
echo -e "For SSL certificates to work properly you need to copy the certificate files into the right location. I assume you have them in below addresses:"
21-
echo -e " - certificate file: /etc/pki/tls/certs/your_cert_file.crt"
22-
echo -e " - certificate key file: /etc/pki/tls/private/your_private_key_file.key"
23-
24-
read -p "Enter the ssl certification file name (localhost.crt):" ssl_crt
25-
ssl_crt=${ssl_crt:-"localhost.crt"}
26-
read -p "Enter the ssl certification private key file name (localhost.key):" ssl_key
27-
ssl_key=${ssl_key:-"localhost.key"}
28-
29-
read -p "Enter your server address (youraddress.com):" server_add
30-
server_add=${server_add:-"youraddress.com"}
31-
32-
read -p "Enter your confluence HTTP Port Number (8090):" http_port
33-
http_port=${http_port:-"8090"}
34-
35-
read -p "Enter your confluence Control Port Number (8000):" control_port
36-
control_port=${control_port:-"8000"}
37-
38-
read -p "Enter the version of confluence you want to install(6.7.2):" confluence_ver
39-
confluence_ver=${confluence_ver:-"6.7.2"}
40-
18+
#For SSL certificates to work properly you need to copy the certificate files into the right location.
19+
#I assume you have created them and have them in below addresses:"
20+
#Default location: certificate file: /etc/pki/tls/certs/your_cert_file.crt"
21+
#Default location: certificate key file: /etc/pki/tls/private/your_private_key_file.key"
22+
ssl_crt="localhost.crt"
23+
ssl_key="localhost.key"
24+
server_add="youraddress.com"
25+
http_port="8090"
26+
control_port="8000"
27+
#Confluence server version that you want to install.
28+
confluence_ver="6.10.1"
4129
#Java keystore password default value. Default value most certainly hasn't been changed.
4230
keystore_pwd=changeit
43-
###################################################################ee
4431

32+
###################################################################
33+
#Start Environment Preparation
34+
###################################################################
4535
#general prep
4636
echo -e "\033[32m Install some generic packages\033[0m"
4737
yum update -y
@@ -53,6 +43,12 @@ echo -e "\033[32mInstall packages you need for confluence\033[0m"
5343
yum install -y postgresql96-server\
5444
httpd24-httpd httpd24-mod_ssl httpd24-mod_proxy_html
5545

46+
#Selinux config mode update to permissive
47+
48+
echo -e "\033[32mFor apache to work properly with ssl, change the mode to permissive\033[0m"
49+
sed -i 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config && echo SUCCESS || echo FAILURE
50+
51+
5652
#setup database server
5753
/usr/pgsql-9.6/bin/postgresql96-setup initdb
5854

@@ -64,24 +60,22 @@ sed -i "s|host all all 127.0.0.1/32.*|host all
6460
systemctl enable postgresql-9.6
6561
systemctl start postgresql-9.6
6662

67-
#prepare database: create database, user and grant permissions to the user
63+
#prepare database:
64+
#create database, user and grant permissions to the user
6865
printf "CREATE USER $confluence_user WITH PASSWORD '$confluence_usr_pwd';\nCREATE DATABASE $confluence_db WITH ENCODING='UNICODE' LC_COLLATE='C' LC_CTYPE='C' TEMPLATE=template0;\nGRANT ALL PRIVILEGES ON DATABASE $confluence_db TO $confluence_user;" > myconf/confluence-db.sql
6966

7067
sudo -u postgres psql -f myconf/confluence-db.sql
7168

7269

73-
#Selinux config mode update to permissive
74-
75-
echo -e "\033[32mFor apache to work properly with ssl, change the mode to permissive\033[0m"
76-
sed -i 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config && echo SUCCESS || echo FAILURE
77-
78-
79-
8070
#create customised files
8171
cp -v CONF/httpd/confluence.conf myconf/
8272
cp -v CONF/confluence/server.xml myconf/
8373
cp -v CONF/confluence/response.varfile myconf/
8474

75+
76+
#############################################################################
77+
#Setup Apache Server
78+
#############################################################################
8579
#update confluence.conf virtual host file
8680

8781
mkdir -pv /opt/rh/httpd24/root/var/www/confluence/logs/
@@ -99,8 +93,10 @@ systemctl start httpd24-httpd
9993
cp -v myconf/confluence.conf /opt/rh/httpd24/root/etc/httpd/conf.d/
10094

10195

102-
96+
#############################################################################
10397
#download and prepare confluence
98+
#############################################################################
99+
104100
sed -i "s|8090|$http_port|g" myconf/response.varfile && echo "http port updated on successfully" || echo "server port update on confluence.conf failed"
105101
sed -i "s|8000|$control_port|g" myconf/response.varfile && echo "control port updated on successfully" || echo "server port update on confluence.conf failed"
106102

@@ -116,8 +112,9 @@ cp -v myconf/server.xml /opt/atlassian/confluence/conf/server.xml
116112
echo -e "\033[32mSSL certification is going to be added to confluence java keystore\033[0m"
117113
/opt/atlassian/confluence/jre/bin/keytool -import -alias $server_add -keystore /opt/atlassian/confluence/jre/lib/security/cacerts -storepass $keystore_pwd -file /etc/pki/tls/certs/$ssl_crt
118114

119-
120-
#reboot
115+
###############################################################################
116+
#finally reboot the server
117+
###############################################################################
121118
echo -e "\033[32mGreat!!! confluence installation completed successfully."
122119
echo "Your system needs to be rebooted before you can continue to setup your system from GUI."
123120
echo "After restart you need to complete the setup from a web browser. Navigate to: https://$server_add"

0 commit comments

Comments
 (0)