Skip to content

Commit d8490bf

Browse files
authored
Merge pull request sjoulaei#4 from sjoulaei/express-install-option
unattended install
2 parents 424100a + 1e7cfc6 commit d8490bf

File tree

2 files changed

+44
-45
lines changed

2 files changed

+44
-45
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ It installs:
66
* setup ssl certificates
77
* prepare confluence database
88

9-
**This script is not meant to cover all basis. It is created to ease the installation of confluence on a fresh Centos7 installation. **
9+
** Warning **
10+
** This script is not meant to cover all basis. It is created to ease the installation of confluence on a fresh Centos7 installation. **
1011

1112
I haven't spent much time on error handling and covering all various scenarios.
1213

@@ -16,11 +17,11 @@ It is tested on newly installed Centos7 machines on VM and DigitalOcean droplets
1617

1718
Create a new Centos7 (minimal installation will do) installation. Login with `root` or other priveledged user and run below commands
1819

19-
yum install git
20+
sudo yum install git
2021
cd /opt/
21-
git clone https://github.com/sjoulaei/install-confluence-centos.git
22+
sudo git clone https://github.com/sjoulaei/install-confluence-centos.git
2223
cd install-confluence-centos
23-
./install-confluence.sh
24+
sudo ./install-confluence.sh
2425

2526
Few questions will be asked about the details of the installation. The only one that you need to change is the password for the confluence database user. The rest can be left as default values (just press Enter).
2627

install-confluence.sh

Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,38 @@
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+
#to access from outside change this to public address. e.g. confluence.yourdomain.com
25+
server_add="localhost"
26+
http_port="8090"
27+
control_port="8000"
28+
#Confluence server version that you want to install.
29+
confluence_ver="6.10.1"
4130
#Java keystore password default value. Default value most certainly hasn't been changed.
4231
keystore_pwd=changeit
43-
###################################################################ee
4432

33+
###################################################################
34+
#Start Environment Preparation
35+
###################################################################
4536
#general prep
4637
echo -e "\033[32m Install some generic packages\033[0m"
4738
yum update -y
@@ -53,6 +44,12 @@ echo -e "\033[32mInstall packages you need for confluence\033[0m"
5344
yum install -y postgresql96-server\
5445
httpd24-httpd httpd24-mod_ssl httpd24-mod_proxy_html
5546

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

@@ -64,24 +61,22 @@ sed -i "s|host all all 127.0.0.1/32.*|host all
6461
systemctl enable postgresql-9.6
6562
systemctl start postgresql-9.6
6663

67-
#prepare database: create database, user and grant permissions to the user
64+
#prepare database:
65+
#create database, user and grant permissions to the user
6866
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
6967

7068
sudo -u postgres psql -f myconf/confluence-db.sql
7169

7270

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-
8071
#create customised files
8172
cp -v CONF/httpd/confluence.conf myconf/
8273
cp -v CONF/confluence/server.xml myconf/
8374
cp -v CONF/confluence/response.varfile myconf/
8475

76+
77+
#############################################################################
78+
#Setup Apache Server
79+
#############################################################################
8580
#update confluence.conf virtual host file
8681

8782
mkdir -pv /opt/rh/httpd24/root/var/www/confluence/logs/
@@ -99,8 +94,10 @@ systemctl start httpd24-httpd
9994
cp -v myconf/confluence.conf /opt/rh/httpd24/root/etc/httpd/conf.d/
10095

10196

102-
97+
#############################################################################
10398
#download and prepare confluence
99+
#############################################################################
100+
104101
sed -i "s|8090|$http_port|g" myconf/response.varfile && echo "http port updated on successfully" || echo "server port update on confluence.conf failed"
105102
sed -i "s|8000|$control_port|g" myconf/response.varfile && echo "control port updated on successfully" || echo "server port update on confluence.conf failed"
106103

@@ -116,8 +113,9 @@ cp -v myconf/server.xml /opt/atlassian/confluence/conf/server.xml
116113
echo -e "\033[32mSSL certification is going to be added to confluence java keystore\033[0m"
117114
/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
118115

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

0 commit comments

Comments
 (0)