-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup
210 lines (160 loc) · 6.26 KB
/
setup
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# run all commands as super user
#update or set root password
passwd
# Update system first
apt update && apt upgrade -y
# Install, start and enable apache
apt install apache2
systemctl start apache2
systemctl enable apache2
# Install additional needed packages
apt install -y git wget curl unzip nano
# Add PHP repository
apt-get install -y software-properties-common
add-apt-repository ppa:ondrej/php
####Very Important to install PHP version 7.1#######
apt install -y php7.1 libapache2-mod-php7.1 php7.1-mysql \
php7.1-cli php7.1-common php7.1-fpm php7.1-soap php7.2-gd \
php7.1-json php7.1-opcache php7.1-mbstring php7.1-zip \
php7.1-bcmath php7.1-intl php7.1-xml php7.1-curl \
php7.1-imap php7.1-ldap php7.1-gmp
# Edit PHP file
nano /etc/php/7.1/apache2/php.ini
# Make sure these options are change to the following
file_uploads = On
allow_url_fopen = On
short_open_tag = On
memory_limit = 256M
cgi.fix_pathinfo = 0 # if you do not find it will not affect the install do not worry!!
upload_max_filesize = 100M
max_execution_time = 360
#Install Webmin for web based server administration
echo "deb http://download.webmin.com/download/repository sarge contrib" >> /etc/apt/sources.list
wget -q -O- http://www.webmin.com/jcameron-key.asc | apt-key add
clear
echo "Installing Webmin Web GUI for Server Administration"
apt update && apt install webmin -y
# Setup IONCUBE
cd ~
wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar xvfz ioncube_loaders_lin_x86-64.tar.gz
# Copy ion cube loader to Directory. Replace your yourpath below with actual path that was shown in the last step
php -i | grep extension_dir
cp ioncube/ioncube_loader_lin_7.1.so /usr/lib/php/'replaceyourpath'
sed -i '2 a zend_extension = "/usr/lib/php/'replaceyourpath'/ioncube_loader_lin_7.1.so"' /etc/php/7.1/apache2/php.ini
sed -i '2 a zend_extension = "/usr/lib/php/'replaceyourpath'/ioncube_loader_lin_7.1.so"' /etc/php/7.1/cli/php.ini
systemctl restart apache2
# Install MariaDB, start and mariadb
apt install -y mariadb-server-10.3
systemctl start mariadb
systemctl enable mariadb
# Secure the database
mysql_secure_installation
# Install PHPMyAdmin
apt install phpmyadmin
# Download Faveo helpdesk community
cd /var/www/
git clone https://github.com/ladybirdweb/faveo-helpdesk.git
# Setup Database
mysql -u root -p
CREATE DATABASE faveo; CREATE USER 'faveo'@'localhost' IDENTIFIED BY 'strongpassword';GRANT ALL ON faveo.* TO 'faveo'@'localhost';FLUSH PRIVILEGES;exit
# add permisions to faveo directory
chown -R www-data:www-data /var/www/faveo
cd /var/www/faveo/
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
# create apache configuration file for faveo helpdesk
nano /etc/apache2/sites-available/faveo.conf
# copy configuration into your config files
<VirtualHost *:80>
ServerName servername
ServerAdmin webmaster@localhost
DocumentRoot /var/www/faveo/public
<Directory /var/www/faveo/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# Uncomment the below lines and replace the Server-IP and Domainame to configure IP to Domainname rewrite rule
# RewriteEngine on
# RewriteCond %{HTTPS} !=on
# RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
</VirtualHost>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName servername
DocumentRoot /var/www/faveo/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
<Directory /var/www/faveo/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
# SSLRequireSSL On
# SSLVerifyClient optional
# SSLVerifyDepth 1
# SSLOptions +StdEnvVars +StrictRequire
</VirtualHost>
# create self signed certificate
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/apache-selfsigned.key -out /etc/ssl/certs/apache-selfsigned.crt
# enable apache mods and disable default site and enalbe ssl then restart apache
a2enmod rewrite
a2dissite 000-default.conf
a2ensite faveo.conf
a2enmod proxy_fcgi setenvif
a2enconf php7.1-fpm
a2enmod ssl
service php7.1-fpm restart
service apache2 restart
# set cron job
echo "* * * * * www-data /usr/bin/php /var/www/faveo/artisan schedule:run 2>&1" | sudo tee /etc/cron.d/faveo
# install redis server
apt-get install redis-server
systemctl start redis-server
systemctl enable redis-server
# install supervisor
apt-get install supervisor
#Copy paste the below configuration.( Change the directories according to your configuration)
nano /etc/supervisor/conf.d/faveo-worker.conf
[program:faveo-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/faveo/artisan queue:work redis --sleep=3 --tries=3
autostart=true
autorestart=true
numprocs=8
redirect_stderr=true
stdout_logfile=/var/www/faveo/storage/logs/worker.log
[program:faveo-recur]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/faveo/artisan queue:work redis --queue=recurring --sleep=3 --tries=3
autostart=true
autorestart=true
numprocs=1
redirect_stderr=true
stdout_logfile=/var/www/faveo/storage/logs/worker.log
[program:faveo-Reports]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/faveo/artisan queue:work redis --queue=reports --sleep=3 --tries=3
autostart=true
autorestart=true
user=www-data
numprocs=1
redirect_stderr=true
stdout_logfile=/var/www/faveo/storage/logs/reports-worker.log
[program:faveo-Horizon]
process_name=%(program_name)s
command=php /var/www/faveo/artisan horizon
autostart=true
autorestart=true
user=www-data
redirect_stderr=true
stdout_logfile=/var/www/faveo/storage/logs/horizon-worker.log
systemctl restart supervisor
now navigate to https://localhost
to complete install of your new faveo community helpdesk