Skip to content

Commit

Permalink
Merge pull request #55 from poppabear8883/Ubuntu-20.04
Browse files Browse the repository at this point in the history
(Add) Ubuntu 20.04 Support
  • Loading branch information
HDVinnie authored Jul 8, 2020
2 parents 9bb4e2f + 9155b94 commit 2d86f39
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 46 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,28 @@
<p align="center"><b>NOTE: This only works for a fresh server with nothing on it but a new OS install!</b></p>

## This Repository
Installer for the [UNIT3D Torrent Tracker Platform](https://github.com/HDInnovations/UNIT3D).
Installer for the [UNIT3D Torrent Tracker Platform](https://github.com/HDInnovations/UNIT3D-Community-Edition).

**Officially Supported OS's**
- Ubuntu 20.04 LTS (Recommended)
- Ubuntu 18.04 LTS
- Ubuntu 16.04 LTS

**For latest release:**
**For Ubuntu 20.04 LTS:**
```
git clone https://github.com/poppabear8883/UNIT3D-INSTALLER.git installer
cd installer
sudo ./install.sh
```

**For Ubuntu 16.04 LTS or Ubuntu 18.04 LTS:**
```
git clone https://github.com/poppabear8883/UNIT3D-INSTALLER.git installer
git checkout Ubuntu-16.04-18.04
cd installer
sudo ./install.sh
```

### General Support
You can find us on the [UNIT3D Discord](https://discord.gg/Yk4NBUU) in the `#support` channel.

Expand Down
22 changes: 6 additions & 16 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ source tools/colors.sh

# Detect OS
case $(head -n1 /etc/issue | cut -f 1 -d ' ') in
Debian) type="debian" ;;
Ubuntu) type="ubuntu" ;;
*) type='' ;;
esac
Expand All @@ -18,10 +17,15 @@ if [ "$type" = '' ]; then
echo -e "\n$Purple This can happen if you are using an OS template from a provider like OVH amongst others. $Color_Off\n"

PS3='Please select the # for your OS: '
options=("Ubuntu 18.04" "Ubuntu 16.04" "Other Ubuntu" "Debian" "Other" "Quit")
options=("Ubuntu 20.04" "Ubuntu 18.04" "Ubuntu 16.04" "Quit")
select opt in "${options[@]}"
do
case $opt in
"Ubuntu 20.04")
echo 'Ubuntu 20.04 LTS \n \l' > /etc/issue
type='ubuntu'
break
;;
"Ubuntu 18.04")
echo 'Ubuntu 18.04 LTS \n \l' > /etc/issue
type='ubuntu'
Expand All @@ -32,20 +36,6 @@ if [ "$type" = '' ]; then
type='ubuntu'
break
;;
"Other Ubuntu")
echo 'Ubuntu UNKNOWN LTS \n \l' > /etc/issue
type='ubuntu'
break
;;
"Debian")
echo 'Debian GNU/Linux \n \l' > /etc/issue
type='debian'
break
;;
"Other")
echo -e "$Red Unsupported GNU/Linux distribution $Color_Off"
exit 1
;;
"Quit")
exit 0
;;
Expand Down
2 changes: 0 additions & 2 deletions src/Configs/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
* Map to the Installer class
*/
'MySql' => MySqlSetup::class,

//'MariaDB' => '',
//'Postgres' => '',
],
Expand Down Expand Up @@ -53,6 +52,5 @@

/* API Keys */
'tmdb-key' => '',
'omdb-key' => '',
'igdb-key' => '',
];
3 changes: 2 additions & 1 deletion src/Configs/os.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* UBUNTU
*/
'ubuntu' => [
'pkg_manager' => 'apt-get',
'pkg_manager' => 'apt',
'web-user' => 'www-data',
'install_dir' => '/var/www/html',
'nginx-sites-available_path' => '/etc/nginx/sites-available',
Expand All @@ -25,6 +25,7 @@
'zip' => 'Compress Files',
'unzip' => 'Decompress Files',
'htop' => 'Monitor Server Resources',
'libpng12-0' => 'PNG Library',
],
]

Expand Down
3 changes: 3 additions & 0 deletions src/Helpers/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ function distinfo()
$mainver = $matches[0];

switch ($mainver) {
case "20.04":
$relname = "(Focal Fossa)";
break;
case "18.04":
$relname = "(Bionic Beaver)";
break;
Expand Down
6 changes: 3 additions & 3 deletions src/Installer/Database/MySqlSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ public function handle()
$this->process(['cp -f ' . resource_path(distname() . "/mysql/$mycnf") . ' /etc/mysql/my.cnf']);

if (distname() === 'ubuntu') {
if (distmainver() !== '16.04' && distmainver() !== '18.04') {
if (distmainver() !== '16.04' && distmainver() !== '18.04' && distmainver() !== '20.04') {
$this->process(['mysql_install_db']);
}

if (distmainver() === '18.04' && !is_dir('/var/lib/mysql')) {
if ((distmainver() === '18.04' || distmainver() === '20.04') && !is_dir('/var/lib/mysql')) {
$this->process([
'mkdir /var/lib/mysql',
'chown mysql:mysql /var/lib/mysql',
Expand Down Expand Up @@ -64,7 +64,7 @@ public function handle()
"mysql -e \"CREATE DATABASE $db\"",
"mysql -e \"CREATE USER '$dbuser'@'localhost' IDENTIFIED BY '$dbpass';\"",
"mysql -e \"GRANT ALL PRIVILEGES ON $db . * TO '$dbuser'@'localhost'\"",
"mysql -e \"UPDATE mysql.user SET authentication_string=PASSWORD('$root_pass') WHERE User='root'\"",
"mysql -e \"ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '$root_pass'\"",
"mysql -e \"DELETE FROM mysql.user WHERE User=''\"",
"mysql -e \"DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1')\"",
]);
Expand Down
2 changes: 1 addition & 1 deletion src/Installer/Nginx/NginxSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function handle()
"systemctl restart nginx"
]);

$this->install('python-certbot-nginx');
$this->install('certbot python3-certbot-nginx');

if ($ssl == 'yes') {
$this->process([
Expand Down
9 changes: 0 additions & 9 deletions src/Installer/Server/ServerSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,6 @@ protected function apiKeys()
$key = $this->question('TMDB Key', '');
$this->config->app('tmdb-key', $key);

$this->io->writeln('<fg=magenta>Obtaining an OMDB Key</>:');
$this->io->listing([
'Visit <fg=cyan>https://www.omdbapi.com/apikey.aspx</>',
'Choose Free or Patreon (Recommended)',
]);

$key = $this->question('OMDB Key', '');
$this->config->app('omdb-key', $key);

$this->io->writeln('<fg=magenta>Obtaining an IGDB Key</>:');
$this->io->listing([
'Visit <fg=cyan>https://api.igdb.com</>',
Expand Down
8 changes: 2 additions & 6 deletions src/Installer/UNIT3D/Unit3dSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ protected function env()
'{{OWNEREMAIL}}' => $this->config->app('owner_email'),
'{{OWNERPASSWORD}}' => $this->config->app('password'),
'{{TMDBAPIKEY}}' => $this->config->app('tmdb-key'),
'{{OMDBAPIKEY}}' => $this->config->app('omdb-key'),
'{{IGDBAPIKEY}}' => $this->config->app('igdb-key'),
'{{MAILDRIVER}}' => $this->config->app('mail_driver'),
'{{MAILHOST}}' => $this->config->app('mail_host'),
Expand Down Expand Up @@ -119,10 +118,7 @@ protected function setup()
$this->process([
'supervisorctl reread',
'supervisorctl update',
'supervisorctl reload',
'wget -q -O /tmp/libpng12.deb http://mirrors.kernel.org/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.54-1ubuntu1_amd64.deb',
'dpkg -i /tmp/libpng12.deb',
'rm /tmp/libpng12.deb'
'supervisorctl reload'
]);

$www_cmds = [
Expand Down Expand Up @@ -152,7 +148,7 @@ protected function crons()
$install_dir = $this->config->os('install_dir');

$this->process([
"(crontab -l ; echo \"* * * * * www-data php $install_dir/artisan schedule:run >> /dev/null 2>&1\") | crontab -"
"(crontab -l ; echo \"* * * * * php $install_dir/artisan schedule:run >> /dev/null 2>&1\") | crontab -"
]);
}

Expand Down
1 change: 0 additions & 1 deletion src/Resources/.env.stub
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,4 @@ DEFAULT_OWNER_EMAIL={{OWNEREMAIL}}
DEFAULT_OWNER_PASSWORD={{OWNERPASSWORD}}

TMDB_API_KEY={{TMDBAPIKEY}}
OMDB_API_KEY={{OMDBAPIKEY}}
IGDB_TOKEN={{IGDBAPIKEY}}
7 changes: 3 additions & 4 deletions src/Resources/intro.stub
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
</>

*-----------------------------------------------*
| |
| Copyright (c) 2018-2019 |
| Author: Poppabear |
| |
| Copyright: 2018-2020 |
| Author: Poppabear |
| Maintainer: HDVinnie |
*-----------------------------------------------*
2 changes: 1 addition & 1 deletion ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ check() {

check_locale

add_ppa ppa:nginx/development ppa:ondrej/php ppa:certbot/certbot
add_ppa ppa:linuxuprising/libpng12

add_pkgs

Expand Down

0 comments on commit 2d86f39

Please sign in to comment.