[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-relays] TOR installation (walentyczerwinski85)
- To: tor-relays@xxxxxxxxxxxxxxxxxxxx
- Subject: Re: [tor-relays] TOR installation (walentyczerwinski85)
- From: Patrice Bönig <mailinglist@xxxxxxxxxx>
- Date: Sun, 23 May 2021 11:17:33 +0200
- Arc-authentication-results: i=1; strato.com; dkim=permerror header.d="pboenig.de" header.s="dkim" header.a="rsa-sha256" reason="No key for signature"
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1621761459; s=strato-dkim-0002; d=strato.com; h=Date:Message-ID:To:Subject:From:Cc:Date:From:Subject:Sender; bh=dLjKeNHBHTiANQIatKnPSdDyCLp5k5mQzzAoBL15jtY=; b=b4NPpY3Bsg6ISav10/qdVa3vLkyB0jvekzQb03yWEoSuyJPHXFxeuDtsIDoX2ig4ga gbXa8geauBTuafnzuThR352YJITctKPOV85iRPEpPj58wNYXop0sWkAHcO6JzvVa1PFx /J3V/gmdRRzaALrqtvjt22ZOkXKyExNut4XC+sjTsAqjAH2aAhn+rO71Eehpw7+dUaer 4751Z9sT/eggaxvAys/8ITYusD9gYjkdSu5ccNsHqjjTPn8729ezNj8wUhNPDyfQHjMT ZOsa7lFaBJpuiK5oKhuJJQU2dn3IdB4ayNSAMlehaL8SN9SjAnl7fjKpPq9/TWKLl+e0 mFfw==
- Arc-seal: i=1; a=rsa-sha256; t=1621761459; cv=none; d=strato.com; s=strato-dkim-0002; b=kBrP0XqeKFSWVc3QCZz2Kf8ZTJJZ73mZ0R9mht18FK2YZTVmCHeP2guPfdShn3yT7W F8CC8GU1UPurHNSzGVxlveAX07LSA5jzHlKkXxPOL32gZ3A5Biu1u2bQvhp7kYuwwDYx pxSAiN3cnZFPxRc7K6cHs2+crFkk6oxyb6FYjZorfEBGbnJ3z/67BvrWNvwdo9125qiD Hc7DBGE8G9VPQX/wEHHTahLVuICv26JdmPHqzpfztOerKK09fSOka5DdRKYDL875WHwm g4wItyyptSxqr44STQ+Zr23DIZI/YCMaB/OptXIwTDisLBQDsc7DaU4qc4BjoCMl8eTF JilQ==
- Authentication-results: strato.com; dkim=permerror header.d="pboenig.de" header.s="dkim" header.a="rsa-sha256" reason="No key for signature"
- Delivered-to: archiver@xxxxxxxx
- Delivery-date: Mon, 24 May 2021 04:06:38 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1621761459; s=strato-dkim-0002; d=pboenig.de; h=Date:Message-ID:To:Subject:From:Cc:Date:From:Subject:Sender; bh=dLjKeNHBHTiANQIatKnPSdDyCLp5k5mQzzAoBL15jtY=; b=PC3FP2xi61oqWI0FoLv+mH5w8IPV4cQhtLH9BQxZSr7qzbHN/oH8UgW2BaYJgcd3vX qDafclQunCUMXxZw8uyJEv5iv5b3QFBn0TvJRvzVdexgc8yk7tDdQqlMVeQUeP8a1DZ8 W6Z2ZkNNoYCLJZRHDzYSZZDYtKPSMIpy3/DxCgJjpKJXyosdsuX2LYxnlodkriC4tAUC R7uMUbyKNKHHl4TPETEbVzSfiQl+D4/9om/2Lz3sCM+/FKy04ppcwJWWzSS074SIZZ8S FIYEnWDdmDEE+HIs3STBjbsdxt7fbc9uoDBRh5JAl+uaTmL+414cCYl9tJ798Nm52FgV 8xpw==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pboenig.de; s=dkim; t=1621761457; h=from:subject:date:message-id:to:mime-version:content-type: content-transfer-encoding:content-language; bh=dLjKeNHBHTiANQIatKnPSdDyCLp5k5mQzzAoBL15jtY=; b=OyDQRbNACLB2Vx3WDCW3TPnWoK8qAm+ud+uDdAy7p/XyNlG9L36hq52MDdTEhPZN+WkzUq DJWS4NYzbaYkc5ZcOH0N8Wh5VQELg+GrzYpb0B+CZujYUtpeBQv/EB3tZp9Kprp88Mb+KK a9h30Z/J9iFxyt04wN2Ag+Td2WOVuQIsqzfjlGFqNsC+Jtlm0Pj8aNucDCm/30PR8db/DC 2vqah1AIWikByZCc8KinNyuVpJNGSltBs+5VDwxdUn4cnfAk8ApKpdFyWYhjq6uV+0YT8z 49vQHt34NfAlSCMi7cfqB+xoJDsoFLOEUYQEVFB4rtEaS0KI4+gOL5gZqwCW/g==
- List-archive: <http://lists.torproject.org/pipermail/tor-relays/>
- List-help: <mailto:tor-relays-request@lists.torproject.org?subject=help>
- List-id: "support and questions about running Tor relays \(exit, non-exit, bridge\)" <tor-relays.lists.torproject.org>
- List-post: <mailto:tor-relays@lists.torproject.org>
- List-subscribe: <https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-relays>, <mailto:tor-relays-request@lists.torproject.org?subject=subscribe>
- List-unsubscribe: <https://lists.torproject.org/cgi-bin/mailman/options/tor-relays>, <mailto:tor-relays-request@lists.torproject.org?subject=unsubscribe>
- Reply-to: tor-relays@xxxxxxxxxxxxxxxxxxxx
- Sender: "tor-relays" <tor-relays-bounces@xxxxxxxxxxxxxxxxxxxx>
- User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0
Hi,
sure, I wrote a script for this. I always compile Tor to use it as a
relay on a Raspberry Pi.
I have attached the script.
regards,
Patrice
######
# Script #
######
##############################################################################################################
## This script is for a automatic installation of tor out of the sources.
## What it will do:
#
# 1. It downloads the newest tarball, compiles and installs it.
# 2. It copies the data dir (with the keys) and the torrc.
# 3. It removes all installations files.
# 4. It starts tor as the current user
# 5. It adds tor as crontab (@bootup) of current user
# 6. changes the permissions of the tor logs, tor folder and torrc for
the current user
# 6. At the end it shows the logs to check the tor startup process
## What are the requirements for this installation script
#
# - the torrc must be in the same folder as this script
# - check the paths used in this script if they fit for your system (the
default paths are for Pi OS)
# - this script must be in a location where it has write permisssions
(for example home folder of current user)
## What this script can't do
#
# Tor is not compiled wioth systemd support, so this won't work until
you switch it on.
##############################################################################################################
#! /bin/bash
# echo output colour #
green="tput setaf 2"
white="tput setaf 7"
yellow="tput setaf 3"
red="tput setaf 1"
#####################
$yellow
echo -e "\n\n####################"
echo -e "# Tor Installation #"
echo -e "####################\n"
# lynx installation
sudo apt install -y lynx
# show tor version for comparison
$yellow
echo -e "\nTor version on the system ->"
$green
tor --version | cut -b 13-20
echo # new line
$yellow
echo -e "Tor version online available ->"
$green
lynx -nonumbers -dump https://dist.torproject.org | grep
"https://dist.torproject.org/tor-" | grep -v "alpha" | grep -v "rc" |
grep -v "asc" | tail -1 | cut -b 33-40
# question for installation
$red
echo -e "\n\n"
read -p "Installing new version? [y/n]: " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
$green
echo -e "\nstopping tor on system...\n"
$white
sudo killall tor
$green
echo -e "\ndone.\n"
$green
echo -e "\nsystem update and installing needed packages...\n"
$white
sudo apt update
sudo apt upgrade -y
sudo apt install -y libevent-dev libssl-dev zlib1g-dev asciidoc
$green
echo -e "\ndone.\n"
$white
build_dir="temp"
mkdir $build_dir
cd $build_dir # in ./temp
$green
echo -e "\ndownloading tor from https://dist.torproject.org ...\n"
$white
lynx -nonumbers -dump https://dist.torproject.org | grep
"https://dist.torproject.org/tor-" | grep -v "alpha" | grep -v "rc" |
grep -v "asc" | tail -1 | xargs wget
tar -xvf tor*.tar.gz
cd `ls -d */` # in ./temp/tor-*
$green
echo -e "\ndone.\n"
$green
echo -e "\nbacking up data dir, and changing its user..."
$white
sudo cp -arv /var/lib/tor ./tor
sudo chown -R $(whoami) ./tor
$green
echo -e "\ndone.\n"
$green
echo -e "\ncompiling, removing old version, installing new
version...\n"
$white
./configure && make && sudo make uninstall && sudo make install
$green
echo -e "\ndone.\n"
$green
echo -e "\ncopying torrc and restoring data directory...\n"
$white
sudo cp -av ../../torrc /usr/local/etc/tor/torrc
sudo chwon $(whoami):root /usr/local/etc/tor/torrc
sudo cp -arv ./tor /var/lib/tor
$green
echo -e "\ndone.\n"
cd .. # in ./temp
cd .. # in ./
$green
echo -e "\nremoving build folder and installation files...\n"
$white
sudo rm -R $build_dir
sudo apt autoclean
sudo apt autoremove
$green
echo -e "\ndone.\n"
$green
echo -e "\nadding tor as crontab to start it on @reboot...\n"
$white
if sudo grep -q "@reboot /usr/local/bin/tor --quiet"
/var/spool/cron/crontabs/$(whoami)
then
echo -e "tor is already present as crontab"
else
#echo -e "@reboot /usr/local/bin/tor --quiet" | sudo tee -a
/var/spool/cron/crontabs/$(whoami)
echo -e "tor is added as crontab"
fi
$green
echo -e "\ndone.\n"
$green
echo -e "\nchanging user of log files...\n"
$white
sudo chown -R $(whoami) /var/log/tor
$green
echo -e "\ndone.\n"
$green
echo -e "\nstarting tor...\n"
$white
# start tor
/usr/local/bin/tor --quiet
echo # new line
$yellow
echo -e "\ntor log\n"
$white
sudo tail -c+1 -f /var/log/tor/notices.log
else
$white
exit 1
fi
_______________________________________________
tor-relays mailing list
tor-relays@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-relays