Tor hidden service (private website via Tor network in this case) installation on CentOS (red hat based) Linux server.
Install webserver bundle of your choice. Webserver components: Apache/Nginx + PHP + MySQL
Example bundle: zPanel (easy to work with), Kloxo. Performance oriented + no GUI bundle is https://vpssim.com/ or http://centminmod.com .
Above mentioned bundles should install webserver components for you.
In this tutorial im using zPanel bundle.
After i installed zPanel on CentOS 6.x, i proceed with Tor installation:
If not found, try to add torproject repository file into your /etc/yum.repos.d/ , tutorial thereyum install tor
Once Tor is installed, make it running at boot time:
Then i think its needed to get own onion address for a website.chkconfig tor on
Following command result should be .onion address we will use for the website. We using temporary directory for the purpose of generating .onon address which we will use to create new permanent folder by the webhosting control panel.
(also make sure following command contains proper webserver port number (by default it is 80 for Apache). Sometimes it is 8080 so you need to be sure that in following command you enter correct port number. You can do command "netstat -tlnp" to see open ports and discover which is your webserver one httpd/apache2/nginx).
Once executed above command, copy your .onion address you obtained in above commmand to safe place. Go to your webhosting control panel, (in my case zPanel) and add new domain name which is .onion address you just obtained.echo -e "HiddenServiceDir /var/lib/tor/hidden_service/\nHiddenServicePort 80 127.0.0.1:80" >> /etc/tor/torrc && mkdir /var/lib/tor/hidden_service/ && chown _tor:_tor /var/lib/tor/hidden_service/ && service tor restart && cat /var/lib/tor/hidden_service/hostname
Then you should discover which directory is it where your domain files should be placed. In my case (zPanel) it is:
/var/zpanel/hostdata/zadmin/public_html/YourOnionAddressHere_onion/
Now add your onion address (something.onion) to the /etc/hosts file.
For example my hosts file then contains this:vi /etc/hosts
(i added my onion domain to the localhost IP and to the real public IP)127.0.0.1 localhost.localdomain localhost sub.domain.tld myonionaddresshere.onion
# Auto-generated hostname. Please do not remove this comment.
MYSERVERIPHERE vps host1 host1.mydomain.com myonionaddresshere.onion
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
Then restart Tor to apply changes with website path:
At this time i think it is complete basic installation of the Tor hidden service/website.service tor restart
Now upload files to the onion site directory/path (mentioned abive) and check if you can see it when accessing your .onion address via Tor browser.
If you got 403 error, it can mean your onion site folder (or parent folders) or files do not have proper permission (example if webserver is apache, then do command: chown apache:apache /path/to/onion/site/directory )
If tor do not start, check tor log file:
tail /var/log/tor/tor.log
And Google errors. If some other issues, you can post there error and your webserver type and command cat /etc/tor/torrc|grep -v "#".
Rest of this post of mine is outdated info, should not be followed
---
copy that path (including ending/trailing slash "/" !) and paste it into the following command:
Aim of the above command is to remove lines we create before and add new lines with new permanent path to onion site directory. (One can just update path in the file manually, but Its important that HiddenServiceDir line is before HiddenServicePort line).sed -i "\/var\/lib\/tor\/hidden_service\//d" /etc/tor/torrc;sed -i "HiddenServicePort/d" /etc/tor/torrc;echo "HiddenServiceDir YOUR_ONION_SITE_PATH" >> /etc/tor/torrc;echo "HiddenServicePort 80 127.0.0.1:80" >> /etc/tor/torrc;
Executing above command we remove old path from Tor config. file and use new path.
df -h
Used 606M
After install: 2.7G
free -m
Used 25M
After install around 150M
Execute Linux command to create Tor repository based on data from https://www.torproject.org/docs/rpms.html.en
echo -e "[tor]/n
name=Tor repo
enabled=1
baseurl=https://deb.torproject.org/torproject.org/rpm/el/$(rpm -qa \*-release | grep -Ei "oracle|redhat|centos" | cut -d"-" -f3)/x86_64/$basearch
gpgcheck=1
gpgkey=https://deb.torproject.org/torproject.org/rpm/RPM-GPG-KEY-torproject.org.asc
repo_gpgcheck=1
[tor-source]
name=Tor source repo
enabled=1
autorefresh=0
baseurl=https://deb.torproject.org/torproject.org/rpm/el/$(rpm -qa \*-release | grep -Ei "oracle|redhat|centos" | cut -d"-" -f3)/SRPMS
gpgcheck=1
gpgkey=https://deb.torproject.org/torproject.org/rpm/RPM-GPG-KEY-torproject.org.asc
repo_gpgcheck=1" >> /etc/yum.repos.d/tor.repo && yum install tor -y && service tor start && chkconfig tor on
Disable current Tor configuration(!) and create brand new new Tor configuration file:
Show your Tor hidden service onion address and copy it for further use:mv /etc/tor/torrc /etc/tor/torrc-old && echo "DataDirectory /var/lib/tor
HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80 127.0.0.1:80" >> /etc/tor/torrc && echo "Reload Tor to apply config. changes:" && service tor reload
Then i use webserver package VPSSIM (https://vpssim.com/) to install complete webserver:cat /var/lib/tor/hidden_service/hostname
If you got mysql "Can't connect to local MySQL server through socket" error and dont know mysql password, try to stop mysql setup by command Ctrl +C, the VPS will be rebooted and then one can find tutorial on "how to reset mysql root password".yum -y install wget && wget https://vpssim.com/install && chmod +x install && ./install
One can also use http://centminmod.com webserver package which is larger or manually install webserver components.
Bookmarks