apt-get does not support socks proxies. You need to be sure if the tool you are using does have support to it. That is probably why you get those "405" messages.
Privoxy is the guy you should check out to "convert" your socks5 connections into http proxy, so you will have a local http proxy without cache.
First, clear your
http_proxy variable, but keep your
tor service running and installed. After that, install privoxy:
sudo apt install privoxy
/etc/privoxy/config and add the following line(no mistakes here, there is a dot at the end of the line)
forward-socks5 / localhost:9050 .
This way, all your requests to
privoxy will be redirect to
tor. Ascii art to help :)
+--------+http +---------+socks5 +------+
| apt|get+-----> privoxy +------>+ tor +--------> INTERNET
+--------+ +---------+ +------+
Restart privoxy and export the
sudo systemctl restart privoxy
torsocks to encapsulate all your requests through tor. On this second method, i'm still assuming you have
tor already working and configured on it's default ports.
sudo apt install torsocks
sudo torsocks apt update