-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.odoo.mattermost.nextcloud.sh
193 lines (135 loc) · 5.5 KB
/
install.odoo.mattermost.nextcloud.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
#!/bin/bash
# Update system packages
sudo dnf update -y
# Configure firewall (replace with your specific rules)
sudo firewall-cmd --permanent --add-service={http,https}
sudo firewall-cmd --permanent --add-port=8080/tcp
sudo firewall-cmd --reload
# Install Nginx, MariaDB, PHP, and dependencies
sudo dnf install -y nginx mariadb mariadb-server php php-fpm php-gd php-mbstring php-xml php-curl php-zip unzip \
wget python3 python3-devel python3-setuptools python3-pip gcc gcc-c++ git php-intl php-imagick \
php-opcache php-redis php-apcu php-pecl-apcu-devel
# Install dependencies
sudo dnf install -y wget python3 gcc gcc-c++ git mariadb mariadb-server php php-fpm php-gd php-mbstring php-xml php-curl php-zip unzip pdftk-server
# Start and enable MariaDB and PHP-FPM services
sudo systemctl start mariadb nginx php-fpm
sudo systemctl enable mariadb nginx php-fpm
# Install and configure MariaDB
# Set a strong root password for MariaDB
sudo mysql_secure_installation
# Create databases for Odoo and Nextcloud
sudo mysql -u root -p <<EOF
CREATE DATABASE odoo;
CREATE DATABASE nextcloud;
EOF
# Grant privileges for the databases
sudo mysql -u root -p <<EOF
GRANT ALL PRIVILEGES ON odoo.* TO 'odoo'@'localhost' IDENTIFIED BY 'YourOdooPassword';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost' IDENTIFIED BY 'YourNextcloudPassword';
EOF
# Install Odoo
# Download the latest Odoo codebase (replace 'version' with desired version)
sudo wget https://github.com/odoo/odoo/archive/refs/tags/v16.0.zip
# Extract the codebase
sudo unzip v16.0.zip
# Move the extracted directory
sudo mv odoo-v16.0 /opt/odoo
# Create Odoo configuration file
sudo nano /etc/odoo.conf
# Add the following content to the file, replacing the paths and passwords accordingly:
# [options]
# ; This is the value of the worker to connect to the database.
# db_name = odoo
# db_user = odoo
# db_password = YourOdooPassword
# addons_path = /opt/odoo/addons
# Save and close the file
# Set ownership and permissions
sudo chown -R odoo:odoo /opt/odoo
# Initialize Odoo database
sudo su - odoo -c "/opt/odoo/odoo-server -d odoo --without-demo --stop-after-init"
# Start and enable Odoo service
sudo systemctl daemon-reload
sudo systemctl enable odoo.service
sudo systemctl start odoo.service
# Install Mattermost
# Download the latest Mattermost package
sudo wget https://github.com/mattermost/mattermost/releases/download/v6.7.0/mattermost-v6.7.0-linux-amd64.tar.gz
# Extract the package
sudo tar -xvf mattermost-v6.7.0-linux-amd64.tar.gz
# Move the extracted directory
sudo mv mattermost /opt/mattermost
# Create a system user for Mattermost
sudo useradd --system --user-group mattermost
# Set ownership and permissions
sudo chown -R mattermost:mattermost /opt/mattermost
# Create a symbolic link for the configuration file
sudo ln -s /opt/mattermost/config.sample /opt/mattermost/config.json
# Edit the configuration file (config.json) and adjust settings as needed
# Start Mattermost service
sudo su - mattermost -c "/opt/mattermost/bin/mattermost"
# Install Nextcloud
# Download the latest Nextcloud package
sudo su - nobody -s /bin/bash -c 'wget https://download.nextcloud.com/server/releases/latest-stable.tar.gz'
# Extract the package
sudo tar -xvf latest-stable.tar.gz
# Move the extracted directory
sudo mv nextcloud /opt/nextcloud
# Create a system user for Nextcloud
sudo useradd --system --user-group nextcloud
# Set ownership and permissions
sudo chown -R nextcloud:nextcloud /opt/nextcloud
# Create a symbolic link for the configuration file
sudo ln -s /opt/nextcloud/config/config.php.sample /opt/nextcloud/config/config.php
# Edit the configuration file (config.php) and adjust settings as needed, including database connection details
# Create storage directory with appropriate permissions
sudo mkdir -p /var/www/html/nextcloud/data
sudo chown nextcloud:nextcloud /var/www/html/nextcloud/data
# Configure Nginx for Odoo
sudo nano /etc/nginx/conf.d/odoo.conf
# Paste the following configuration, replacing the paths with your actual installation paths:
server {
listen 8080;
server_name odoo.example.com;
location / {
proxy_pass http://localhost:8069;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
}
# Configure Nginx for Mattermost
sudo nano /etc/nginx/conf.d/mattermost.conf
# Paste the following configuration, replacing the paths with your actual installation paths:
server {
listen 80;
server_name mattermost.example.com;
location / {
proxy_pass http://localhost:8065;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
# Configure Nginx for Nextcloud
sudo nano /etc/nginx/conf.d/nextcloud.conf
# Paste the following configuration, replacing the paths with your actual installation paths:
server {
listen 80;
server_name nextcloud.example.com;
root /var/www/html/nextcloud;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
# Restart Nginx to apply configuration changes
sudo systemctl restart nginx