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 or .
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:

yum install tor
If not found, try to add torproject repository file into your /etc/yum.repos.d/ , tutorial there

Once Tor is installed, make it running at boot time:

chkconfig tor on
Then i think its needed to get own onion address for a website.

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).

echo -e "HiddenServiceDir /var/lib/tor/hidden_service/\nHiddenServicePort 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
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.

Then you should discover which directory is it where your domain files should be placed. In my case (zPanel) it is:


Now add your onion address (something.onion) to the /etc/hosts file.

vi /etc/hosts
For example my hosts file then contains this: localhost.localdomain localhost sub.domain.tld myonionaddresshere.onion
# Auto-generated hostname. Please do not remove this comment.
MYSERVERIPHERE vps host1 myonionaddresshere.onion
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
(i added my onion domain to the localhost IP and to the real public IP)

Then restart Tor to apply changes with website path:

service tor restart
At this time i think it is complete basic installation of the Tor hidden service/website.

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:

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" >> /etc/tor/torrc;
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).

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

echo -e "[tor]/n
name=Tor repo
baseurl=$(rpm -qa \*-release | grep -Ei "oracle|redhat|centos" | cut -d"-" -f3)/x86_64/$basearch

name=Tor source repo
baseurl=$(rpm -qa \*-release | grep -Ei "oracle|redhat|centos" | cut -d"-" -f3)/SRPMS
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:
mv /etc/tor/torrc /etc/tor/torrc-old && echo "DataDirectory /var/lib/tor
HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80" >> /etc/tor/torrc && echo "Reload Tor to apply config. changes:" && service tor reload
Show your Tor hidden service onion address and copy it for further use:
cat /var/lib/tor/hidden_service/hostname
Then i use webserver package VPSSIM ( to install complete webserver:
yum -y install wget && wget && chmod +x install && ./install
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".

One can also use webserver package which is larger or manually install webserver components.