Page tree
Skip to end of metadata
Go to start of metadata

Install Apache server.

First, clean-up yum:

[root@charlie ~]# yum clean all

Update our packages:

[root@charlie ~]# yum -y update

Install Apache:

[root@charlie ~]# yum -y install httpd

Add to start:

[root@charlie ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@charlie ~]#

Firewall Add ports:

[root@charlie ~]# firewall-cmd --permanent --add-port="80"/tcp
success
[root@charlie ~]# firewall-cmd --permanent --add-port="443"/tcp
success

Reload firewall rules:

[root@charlie ~]# firewall-cmd --reload
success

List rules:

[root@charlie ~]# su -c 'firewall-cmd --zone=public --list-all'
public (active)
target: default
icmp-block-inversion: no
interfaces: eth0
sources:
services: dhcpv6-client ssh
ports: 80/tcp 443/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
[root@charlie ~]#

Create new VirtualHost:

[root@charlie ~]# vi /etc/httpd/conf.d/website.wiki.costaflores.com.conf
<VirtualHost *:80>
    ServerName wiki.costaflores.com
    ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
    ProxyPass / http://localhost:8090/
ProxyPassReverse / http://localhost:8090/
<Location />
Order allow,deny
Allow from all
</Location>
    CustomLog logs/wiki.costaflores.com.log combined
ErrorLog logs/wiki.costaflores.com.error.log
</VirtualHost>

[root@charlie ~]# systemctl restart httpd


Install Wget:

[root@charlie ~]# yum -y install wget

Install unzip:

[root@charlie ~]# yum -y install unzip

Install MySQL:

[root@charlie ~]# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
--2018-07-04 17:54:04-- http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
Resolving repo.mysql.com (repo.mysql.com)... 95.100.245.201
Connecting to repo.mysql.com (repo.mysql.com)|95.100.245.201|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6140 (6.0K) [application/x-redhat-package-manager]
Saving to: âmysql-community-release-el7-5.noarch.rpmâ
100%[==============================================================================================================>] 6,140 --.-K/s in 0s
2018-07-04 17:54:04 (317 MB/s) - âmysql-community-release-el7-5.noarch.rpmâ saved [6140/6140]
[root@charlie ~]#
[root@charlie ~]# rpm -ivh mysql-community-release-el7-5.noarch.rpm
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-release-el7-5 ################################# [100%]
[root@charlie ~]# ^C
[root@charlie ~]#
[root@delta ~]# yum update
[root@delta ~]# yum install mysql-server

Init MySQL server:

[root@charlie ~]# systemctl start mysqld

Secure install:

Run the mysql_secure_installation script to address several security concerns in a default MySQL installation.

[root@charlie ~]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
... Failed! Not critical, keep moving...
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!

All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!

Cleaning up...
[root@charlie ~]#

Add to start:

[root@charlie ~]# systemctl enable mysqld

Edit config file /etc/my.cnf

Follow the guide from https://confluence.atlassian.com/doc/database-setup-for-mysql-128747.html

[mysqld]
performance-schema=0
default-storage-engine=InnoDB
innodb_file_per_table=1
max_allowed_packet=268435456
innodb_buffer_pool_size=25165824
open_files_limit=10000
# Confluence
interactive_timeout = 86400
join_buffer_size = 268435456
max_connections = 151
wait_timeout = 86400
# Confluence. Specify the default character set to be UTF-8:
character-set-server=utf8
collation-server=utf8_bin
# Confluence. Specify the value of innodb_log_file_size to be at least 2GB:
# Tambien para poder instalar el add-on Gliffy Diagrams for Confluence
innodb_log_file_size=2GB
# Confluence. Ensure that the global transaction isolation level of your Database had been set to READ-COMMITTED.
transaction-isolation=READ-COMMITTED
#Confluence. Check that the binary logging format is configured to use 'row-based' binary logging.
binlog_format=row
[mysqldump]
# modificado para poder hacer exportaciones con mysqldump
max_allowed_packet=512M


Create Confluence data base:

[root@charlie ~]# mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.6.40 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)
mysql> CREATE USER 'admincp_conflu'@'localhost' IDENTIFIED BY '??????';
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT User,Host,Password FROM mysql.user;
+----------------+-----------+-------------------------------------------+
| User | Host | Password |
+----------------+-----------+-------------------------------------------+
| root | localhost | *00A990DF3FB9BC5218E7BF5746087??????????? |
| root | 127.0.0.1 | *00A990DF3FB9BC5218E7BF5746087??????????? |
| root | ::1 | *00A990DF3FB9BC5218E7BF5746087??????????? |
| admincp_conflu | localhost | *9758FE8EE0C7E0B12989962BFEEEE??????????? |
+----------------+-----------+-------------------------------------------+
4 rows in set (0.00 sec)
mysql> CREATE DATABASE `admincp_confluence` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
Query OK, 1 row affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON admincp_confluence.* TO "admincp_conflu"@"localhost";
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
[root@charlie ~]#

Install JAVA JDK

[root@charlie ~]# cd /opt/
[root@charlie opt]# cp /home/mbarrow/Confluence-backup-2018-07-04/confluence-2018-07-04.tar.gz .
[root@charlie opt]# cp /home/mbarrow/jdk-8u112-linux-x64.tar.gz .
[root@charlie opt]# tar xzf jdk-8u112-linux-x64.tar.gz
[root@charlie opt]#

Install Confluence 6.0.3

[root@charlie opt]# chmod a+x atlassian-confluence-6.0.3-x64.bin
[root@charlie opt]# /opt/atlassian-confluence-6.0.3-x64.bin
Unpacking JRE ...
Starting Installer ...
Jul 05, 2018 5:24:01 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
Jul 05, 2018 5:24:01 PM java.util.prefs.FileSystemPreferences$2 run
INFO: Created system preferences directory in java.home.
This will install Confluence 6.0.3 on your computer.
OK [o, Enter], Cancel [c]
o
Choose the appropriate installation or upgrade option.
Please choose one of the following:
Express Install (uses default settings) [1],
Custom Install (recommended for advanced users) [2, Enter],
Upgrade an existing Confluence installation [3]
2
Where should Confluence 6.0.3 be installed?
[/opt/atlassian/confluence]
Default location for Confluence data
[/var/atlassian/application-data/confluence]
Configure which ports Confluence will use.
Confluence requires two TCP ports that are not being used by any other
applications on this machine. The HTTP port is where you will access
Confluence through your browser. The Control port is used to Startup and
Shutdown Confluence.
Use default ports (HTTP: 8090, Control: 8000) - Recommended [1, Enter], Set custom value for HTTP and Control ports [2]
1
Confluence can be run in the background.
You may choose to run Confluence as a service, which means it will start
automatically whenever the computer restarts.
Install Confluence as Service?
Yes [y, Enter], No [n]
y
Extracting files ...

Please wait a few moments while we configure Confluence.
Installation of Confluence 6.0.3 is complete
Start Confluence now?
Yes [y, Enter], No [n]
n
Installation of Confluence 6.0.3 is complete
Finishing installation ...
[root@charlie opt]#

Copy MySQL connector

[root@charlie opt]# cp mysql-connector-java-5.1.47-bin.jar /opt/atlassian/confluence/lib/
[root@charlie opt]# cp mysql-connector-java-5.1.47-bin.jar /opt/atlassian/confluence/confluence/WEB-INF/lib/

Create new user only for confluence

[root@charlie opt]# useradd --create-home --comment "Account for running Confluence" --shell /bin/bash confluence

Verify Confluence user

[root@charlie opt]# vi /opt/atlassian/confluence2/bin/user.sh

# START INSTALLER MAGIC ! DO NOT EDIT !
CONF_USER="confluence" # user created by installer
# END INSTALLER MAGIC ! DO NOT EDIT !

export CONF_USER

Modify user privileges

[root@charlie opt]# chown -R confluence.confluence /opt/atlassian/confluence/
[root@charlie opt]# chown -R confluence.confluence /var/atlassian/application-data/confluence/
[root@charlie opt]# chmod -R u=rwX,go-rwx /opt/atlassian/confluence/
[root@charlie opt]# chmod -R u=rwX,go-rwx /var/atlassian/application-data/confluence/
[root@charlie opt]#

Edit file to start/stop Confluence

[root@charlie opt]# vi /etc/init.d/confluence
#!/bin/sh -e
# Confluence startup script
#chkconfig: 2345 80 05
#description: Confluence
# Define some variables
# Name of app ( JIRA, Confluence, etc )
APP=confluence
# Name of the user to run as
USER=confluence
# Location of Confluence install directory
CATALINA_HOME=/opt/atlassian/confluence
# Location of Java JDK
export JAVA_HOME=/opt/jdk1.8.0_112
case "$1" in
# Start command
start)
echo "Starting $APP"
/bin/su -m $USER -c "$CATALINA_HOME/bin/start-confluence.sh &> /dev/null"
;;
# Stop command
stop)
echo "Stopping $APP"
/bin/su -m $USER -c "$CATALINA_HOME/bin/stop-confluence.sh &> /dev/null"
echo "$APP stopped successfully"
;;
# Restart command
restart)
$0 stop
sleep 5
$0 start
;;
*)
echo "Usage: /etc/init.d/$APP {start|restart|stop}"
exit 1
;;
esac
exit 0

Start Confluence

[root@charlie opt]# /etc/init.d/confluence start

Stop Confluence

[root@charlie opt]# /etc/init.d/confluence stop


Install Confluence by browser

Enter the provisional url http://newwiki.costaflores.com/ or better with the local IP directly to avoid timeout errors 10.112.48.23:8090/ 


Select "Product Installation" and click "Next" button.


Click "Next" button.


First click "Get an evaluation license" to obtain a license, we copy and paste it and press the "Next" button.



Select "MySQL" and click "External Database" button.


Click "Direct JDBC" button.

Setup Database

  • Driver Class Name: com.mysql.jdbc.Driver
  • Database URL: jdbc:mysql://localhost:3306/admincp_confluence?useUnicode=true&amp;characterEncoding=UTF8&amp;sessionVariables=storage_engine=InnoDB
  • User Name: admincp_conflu
  • Password: ·············


Create the site export file in old server

To create an XML export of your site:

  1. Go to  > General Configuration > Backup & Restore.
  2. Choose Archive to backups folder to store a copy of the backup in the same folder as Confluence's backups
    If you do not archive the backup it will be made available for you to download, and then deleted from the server after 24 hours.
  3. Choose Backup attachments to include attachments in your backup.
  4. Choose Backup.
    The process can take some time.


If you repeatedly experience timeout errors, try creating the export directly from the server. This will speed up the process and prevent timeouts.

For example, use this URL: http://10.112.48.23:8090/confluence/admin/backup.action. directly.

What's included in the export?

The site export includes spaces (including pages, blogs, comments, attachments, and unpublished changes), users and groups.  Essentially everything in your site except add-ons. 

Retrieving the site export file

Confluence will create the backup as a zipped XML file in your <home-directory>/backups> directory. You'll need access to the Confluence server itself in order to retrieve this file.

Restore backup on a new server CHARLEI

Go to  > General Configuration > Backup & Restore.


Select the zip file to restore and click "Restore" button.

Configuring the Site Home Page

To use a page as your site home page:

  1. Go to  > General Configuration > Further Configuration.
  2. Choose Edit.
  3. Select a space from the Site Homepage dropdown menu. 
    When users log in or click the site logo, Confluence will go to the home page of the space you choose here.
  4. Choose Save.



Turning off Collaborative editing and Synchrony

To prevent the error "Unable to communicate with server. Saving is not possible at the moment."

  1. Go to  > General Configuration > Administration > Collaborative Editing.
  2. In "editing mode" block, choose "Change mode".
  3. Turn off. 


Configure SMTP email server

    • Go to  > General Configuration > Mail Servers. This will list all currently configured SMTP servers.
    • Click Add New SMTP Server (or edit an existing server).
    • Edit the following fields as required:
      • Name: By default, this is simply 'SMTP Server'.
      • From Address: Enter the email address that will be displayed in the 'from' field for email messages originating from this server.
        This field is mandatory. This must be an ordinary email address, you can't enter variables in this field. 
      • From Name: Enter the name that will be displayed in the 'from' field for email messages originating from this server. This is the text which appears before the user's registered email address (in square brackets).
        This field accepts the following variables, which reference specific details defined in the relevant Confluence user's profile:

      • Subject Prefix: Enter some text to appear at the beginning of the subject line.

Enter your Hostname, Port, User name and Password details.

Host: smtp.fatcow.com
Port: 587
username: openvino@costaflores.com
Password: ******
Protocol: TLS

Transfer license to new ServerID - Updating your license

If you change your license (for example to a license with more users), or migrate from another server and you will need to update your license. 

To update your Confluence license:

  1. Go to  > General Configuration > License Details
  2. Enter your new license in the License field.
  3. Choose Save.



Crontab entry on Charlie:

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root HOME=/

01 3 * * * /home/confluence/scripts/daily_backup
02 4 * * * /home/confluence/scripts/weekly_backup
42 5 28 * * cp /var/atlassian/application-data/confluence/backups/backup*_??_28* /var/atlassian/application-data/confluence/backups/backup_monthly/monthly_backup.zip
01 1 27 * * scp /var/atlassian/application-data/confluence/backups/backup_monthly/monthly_backup.zip mbarrow@200.74.221.106:/home/mbarrow/backups/charlie/confluence_backup_monthly.zip  &> /home/confluence/monthly_backup.out
01 7 * * * /home/confluence/scripts/removeOldBackups.sh

Remove Confluence old backup zip file

Edit file /home/confluence/scripts/removeOldBackups.sh
#!/bin/bash
# removeOldBackups.sh
# ------------------
fechaHora=$(date +%F_%T)
fecha=$(date +%F)
pathScripts=/home/confluence/scripts
pathBackups=/var/atlassian/application-data/confluence/backup
echo " "
echo " ******* Bylapera removeOldBackups.sh ******* inicio del proceso $fechaHora **"
echo " ** **"
echo " ** elimina los ficheros de backup *.zip de mas de 7 dias de $pathBackups **"
echo " ** elimina los ficheros de logs *.txt de mas de 7 dias de $pathScripts/logs **"
echo " ** **"
echo " ** este proceso se debe ejecutar como usuario root o confluence. **"
echo " ** **"
echo " **************************************************************************************************"
echo " "

# Mostrar el usuario que ejecuta el bash
echo "Nombre de usuario que lo ejecuta: ${USER}"
# Creamos el fichero para el log si no existe.
if [ ! -e $pathScripts/logs/logRemoveOldBackups_$fecha.txt ]; then
echo $fechaHora ". ****** Inicio del removeOldBackups.sh ******" > $pathScripts/logs/logRemoveOldBackups_$fecha.txt
else
echo $fechaHora ". ****** Inicio del removeOldBackups.sh ******" >> $pathScripts/logs/logRemoveOldBackups_$fecha.txt
fi

# PASO 01. Eliminar los ficheros .zip de los backups anteriores a 7 dias.
echo $fechaHora " . Paso 01/02. Listado ficheros a borrar: "
echo $fechaHora " . Paso 01/02. Listado ficheros a borrar: " >> $pathScripts/logs/logRemoveOldBackups_$fecha.txt
find $pathBackups -name "*.zip" -type f -mtime +6 -print >> $pathScripts/logs/logRemoveOldBackups_$fecha.txt
find $pathBackups -name "*.zip" -type f -mtime +6 -print -delete
RETVALBORRAR1=$?
fechaHora=$(date +%F_%T)
echo $fechaHora " . Paso 01/02. El resultado de BORRAR los ficheros *.zip de más de 7 dias es: $RETVALBORRAR1"
echo $fechaHora " . Paso 01/02. El resultado de BORRAR los ficheros *.zip de más de 7 dias es: $RETVALBORRAR1" >> $pathScripts/logs/logRemoveOldBackups_$fecha.txt

# PASO 02. Eliminar los ficheros .txt de los logs anteriores a 7 dias.
rm -f `find $pathScripts/logs -mtime +7`
RETVALBORRAR2=$?
fechaHora=$(date +%F_%T)
echo $fechaHora " . Paso 02/02. El resultado de BORRAR los ficheros /logs/logRemoveOldBackups_*.txt de más de 7 dias es: $RETVALBORRAR2"
echo $fechaHora " . Paso 02/02. El resultado de BORRAR los ficheros /logs/logRemoveOldBackups_*.txt de más de 7 dias es: $RETVALBORRAR2" >> $pathScripts/logs/logRemoveOldBackups_$fecha.txt

echo $fechaHora ". ****** FIN proceso remove old backups removeOldBackups.sh ******"
echo $fechaHora ". ****** FIN proceso remove old backups removeOldBackups.sh ******" >> $pathScripts/logs/logRemoveOldBackups_$fecha.txt
echo " " >> $pathScripts/logs/logRemoveOldBackups_$fecha.txt
  • No labels