Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- echo "Welcome to dolphin's LynxChan install script!"
- script_version="1.0.8"
- new_version=$(curl "https://boxeddolphin.com/lynxchan/lynxchan_version_install_script" -s)
- script_name=`basename "$0"`
- distro_name=$(lsb_release -a | grep "Distributor ID:" > /tmp/distro_ver && sed -i "s/Distributor ID://g" /tmp/distro_ver && sed -i "s/No LSB modules are available.//g" /tmp/distro_ver && cat /tmp/distro_ver | tr -d " \t\n\r")
- front_ends=$(curl "https://boxeddolphin.com/lynxchan/front-ends")
- if [ "$script_version" != "$new_version" ]; then
- echo "Downloading update..."
- wget "https://boxeddolphin.com/install_lynxchan.sh" -O $script_name
- bash $script_name
- fi
- echo "What is your domain name, e.g. dolphin.com?"
- read domain
- echo "Where do you want LynxChan to be stored? I recommend /opt/LynxChan."
- read lynxchan_dir
- echo "What is your chan called?"
- read chan_name
- echo "Front-ends:"$front_ends
- echo "What is your chan's front-end?"
- read front_end
- echo "Enable tor? Answer 'yes' or 'no'"
- read tor_enabled
- function install_tor {
- mkdir /var/lib/tor/imageboard/ -p
- if [ "$distro_name" == "Debian" ]; then
- sudo apt install -y tor
- chown -R debian-tor:debian-tor /var/lib/tor/imageboard/
- chmod -R 700 /var/lib/tor/imageboard/
- fi
- if [ "$distro_name" == "Ubuntu" ]; then
- sudo apt install -y tor
- chown -R debian-tor:debian-tor /var/lib/tor/imageboard/
- chmod -R 700 /var/lib/tor/imageboard/
- fi
- echo "
- HiddenServiceDir /var/lib/tor/imageboard/
- HiddenServicePort 80 127.0.0.1:8081
- " >> /etc/tor/torrc
- sudo systemctl restart tor
- }
- function install_mongodb {
- if [ "$distro_name" == "Debian" ]; then
- echo "Installing required packages for MongoDB!"
- sudo apt install -y gnupg wget nano
- wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
- echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
- sudo apt update
- sudo apt full-upgrade -y
- sudo apt install mongodb-org -y
- fi
- if [ "$distro_name" == "Ubuntu" ]; then
- echo "Installing required packages for MongoDB, then I will install MongoDB for you!"
- sudo apt install -y gnupg wget nano
- wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
- echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
- sudo apt update
- sudo apt full-upgrade -y
- sudo apt install mongodb-org -y
- sudo systemctl enable mongod && sudo systemctl start mongod
- fi
- }
- function install_nodejs {
- if [ "$distro_name" == "Debian" ]; then
- echo "Installing NodeJS..."
- curl -sL https://deb.nodesource.com/setup_13.x | bash -
- apt-get install -y nodejs
- apt-get install -y build-essential
- fi
- if [ "$distro_name" == "Ubuntu" ]; then
- echo "Installing NodeJS..."
- curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
- sudo apt-get install -y nodejs
- apt-get install -y build-essential
- fi
- }
- function install_lynxchan {
- if [ "$distro_name" == "Debian" ]; then
- echo "Installing LynxChan..."
- sudo apt install git gcc g++ file exiftool sendmail ffmpeg unzip python make cmake imagemagick libmagick++-dev -y
- sudo git clone https://gitgud.io/LynxChan/LynxChan.git $lynxchan_dir
- cd $lynxchan_dir
- sudo useradd --create-home -d $lynxchan_dir --system --shell /sbin/nologin node
- cd aux
- sudo cp lynxchan.systemd /etc/systemd/system/lynxchan.service
- sudo systemctl daemon-reload && sudo systemctl enable lynxchan.service && sudo systemctl start lynxchan.service
- cd ../src/be
- npm install
- cp -r settings.example settings
- if [ "$front_end" == "lynxchan" ]; then
- git clone https://gitgud.io/LynxChan/PenumbraLynx.git ../fe
- cd ../fe
- git checkout master
- find $lynxchan_dir/src/fe -type f -print0 | xargs -0 sed -i 's/Insert title here/'$chan_name'/g'
- find $lynxchan_dir/src/fe -type f -print0 | xargs -0 sed -i 's/Insert footer here/'$chan_name'/g'
- else
- mkdir $lynxchan_dir/src/fe -p
- wget https://boxeddolphin.com/lynxchan/frontends/$front_end.tar -O $lynxchan_dir/src/fe/$front_end.tar
- cd $lynxchan_dir/src/fe
- tar xvf $front_end.tar
- rm $front_end.tar
- find $lynxchan_dir/src/fe -type f -print0 | xargs -0 sed -i 's/DOLFINCHAN/'$chan_name'/g'
- fi
- sudo ln -s $lynxchan_dir/src/be/boot.js /usr/bin/lynxchan
- echo "Almost done installing LynxChan."
- echo "Copying config from the root server..."
- mkdir $lynxchan_dir/src/be/settings
- wget "https://boxeddolphin.com/lynxchan/lynxchan_general.json" -O $lynxchan_dir/src/be/settings/general.json
- echo "
- {
- \"address\": \"localhost\",
- \"port\": 27017,
- \"db\": \"lynxchan\"
- }
- " > $lynxchan_dir/src/be/settings/db.json
- sudo chown -R node:node $lynxchan_dir
- sudo systemctl start mongod
- sudo systemctl enable mongod
- sudo -u node lynxchan -ca -l root -p "123!" -gr 0 -nd
- fi
- }
- function install_reverse_proxy {
- echo "Installed LynxChan. Going to install apache2 for the reverse proxy"
- sudo apt install -y apache2
- sudo wget "https://boxeddolphin.com/default_lynxchan.conf" -O /etc/apache2/sites-available/lynxchan.conf
- sudo a2enmod proxy
- sudo a2enmod ssl
- sudo a2enmod proxy_http
- sudo a2enmod proxy_https
- sudo a2enmod remoteip
- sudo a2enmod rewrite
- sudo a2ensite lynxchan.conf
- echo "Getting SSL cert"
- sudo apt install -y python3-certbot python-certbot-apache
- sudo certbot --manual --preferred-challenges dns certonly -d $domain
- sudo sed -i "s/mysite.com/$domain/g" /etc/apache2/sites-available/lynxchan.conf
- a2dissite 000-default
- sudo systemctl restart apache2.service
- }
- install_mongodb
- install_nodejs
- install_lynxchan
- install_reverse_proxy
- if [ "$tor_enabled" == "yes" ]; then
- install_tor
- sleep 15
- tor_address=$(cat /var/lib/tor/imageboard/hostname)
- else
- tor_address="TOR NOT ENABLED!"
- echo "No tor :("
- fi
- echo "Starting LynxChan. Default login is root/123!"
- sudo chown -R node:node $lynxchan_dir
- sudo systemctl start lynxchan
- echo "Tor address: $tor_address"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement