Ubuntu 16.04 apt-get not working through proxy - proxy

In Ubuntu 14.04, in order to use some commands in terminal (like apt-get) trough the company proxy, I need to do the following changes, beyond System Settings > Network > Network proxy > "Apply system wide" (shame on you, Ubuntu)
/etc/environment (actually this is the only file modified by System Settings)
http_proxy="http://[webproxy]:[port]/"
https_proxy="https://[webproxy]:[port]/"
ftp_proxy="ftp://[webproxy]:[port]/"
socks_proxy="socks://[webproxy]:[port]/"
/etc/profile
export http_proxy=http://[username]:[password]#[webproxy]:[port]
export https_proxy=http://[username]:[password]#[webproxy]:[port]
export ftp_proxy=http://[username]:[password]#[webproxy]:[port]
sudo visudo
Defaults env_reset
Defaults env_keep = "http_proxy https_proxy ftp_proxy DISPLAY XAUTHORITY"
/etc/apt/apt.conf
Acquire::http::proxy "http://[username]:[password]#[webproxy]:[port]/";
Acquire::https::proxy "https://[username]:[password]#[webproxy]:[port]/";
Acquire::ftp::proxy "ftp://[username]:[password]#[webproxy]:[port]/";
Acquire::socks::proxy "socks://[username]:[password]#[webproxy]:[port]/";
or the same changes in
/etc/apt/apt.conf.d/95proxies
I think that at least the following command (from here)
sudo http_proxy='http://[username]:[password]#[webproxy]:[port]' apt-get update
should work, right?
That's what I remember right now. Not even sure if all of them are really necessary. I did all these changes in Ubuntu 16.04, though, but still can't make sudo apt-get update work through the same proxy (another computer in the same room). Got
Temporary failure resolving '[webproxy]'
What am I missing?

Create a new empty conf file: $ sudo vi /etc/apt/apt.conf
Add this line to the file if you are using http proxy else https of ftp:
Acquire::http::Proxy "http://user:pass#proxy_host:port";
If you don't have a usename and password for your proxy then write:
Acquire::http::Proxy "http://proxy_host:port";
Note: don't miss the semicolon at the end of line.

I had the same problem and I fix it following this solution:
https://www.unixmen.com/45713-2/ from M.el Khamlichi
create a file apt.conf in /etc/apt/
sudo vi /etc/apt/apt.conf
add there the proxy
export http_proxy=http://192.168.168.180:3128
Here you wil put your numbers.
add it to ~/.bash.rc to make this command permanent
vi ~/.bash.rc

The only thing that worked for me in Ubuntu Desktop was to
Go to System Settings
Search for "proxy"
Go to Network Settings
Go to Network proxy
Enter HTTP Proxy and HTTP Proxy settings

Related

Conda ProxyError

I am trying to install conda packages/create environments behind a corporate firewall
On another machine, I managed to install packages from conda default channels by setting the HTTP/HTTPS proxies and ssl_verify: False in conda config.
However, I am now getting ProxyError: Conda cannot proceed due to an error in your proxy configuration. Check for typos and other configuration errors in any '.netrc' file in your home directory, any environment variables ending in '_PROXY', and any other system-wide proxy configuration settings.
I have verified that conda is not accessing any .netrc file through conda info
.condarc:
channels:
- defaults
# Show channel URLs when displaying what is going to be downloaded and
# in 'conda list'. The default is False.
show_channel_urls: True
allow_other_channels: True
proxy_servers:
http: http://abc.cde.local:XXXX
https: https://abc.cde.local:XXXX
ssl_verify: False
Here are the steps I have tried to resolve my issue:
I have verified that the proxy URLs are correct and can make outgoing requests through these URLs
I have tried to set the two settings both through conda config --set and .condarc
I have tried to set the proxies through environmental variables
I cannot make changes to Windows proxy settings or do anything that requires any admin permissions.
Does anyone have any experience with this?
If you know your condarc file is correct, on Windows you need to make sure that your environment variables are "http_proxy" and https_proxy", lowercase.
Also, most proxies use an unencrypted traffic to the proxy. So make sure the URLs to your proxy are both http://
Finally, when you change your enviroment variables in Windows you must start a new powershell session for the changes to take affect.
This and the correct conda RC file solved it for me.

Laravel installation Unable to use a proxy: malformed http_proxy url

I am facing this problem when I try to install Laravel on my Windows machine; how can I solve this problem?
Changed current directory to C:/Users/masab/AppData/Roaming/Composer
[ComposerDownloaderTransportException] Unable to use a proxy: malformed http_proxy url
require [–dev] [–dry-run] [–prefer-source] [–prefer-dist] [–fixed] [–no-suggest] [–no-progress] [–no-update] [–no-install] [–no-scripts] [–update-no-dev] [-w|–update-with-dependencies] [-W|–update-with-all-dependencies] [–with-dependencies] [–with-all-dependencies] [–ignore-platform-req IGNORE-PLATFORM-REQ] [–ignore-platform-reqs] [–prefer-stable] [–prefer-lowest] [–sort-packages] [-o|–optimize-autoloader] [-a|–classmap-authoritative] [–apcu-autoloader] [–apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [–] []…
I'm also facing this error for below command on my Windows system for install laravel.
composer global require laravel/installer
This is global command you can run this from any path on CMD ( command prompt )
but after install wamp or xampp server then http_proxy environment veritable created in your administatory system
Control Panel -> System -> Advanced system settings -> Environment Veriables -> http_proxy
Method 1: Delete http_proxy Veriable and run again the same command from any path. then its works fine.
OR
Method 2: keep the http_proxy Veriable as it is. and open your project directory on CMD ( command prompt ) and run laravel/installer command in your project directory.
My project example : D:>cd wamp\www\laraveldemo
after this enter your command and run it.
This could be because you clicked on HTTP proxy and set the wrong value while installing your composer.
To solve this bug, go to the system environment file (Simply type env in your search and open). Once you open it, you'll find an HTTP option, click on it and delete it. After this, restart your System and reinstall Composer. This time, do not select the HTTP proxy.
Otherwise, set the correct value to the HTTP proxy.
After installation, try rerunning your laravel command and the problem will be solved. Goodluck

www-data can't find the ruby gems on vagrant configured virtualbox

I'm trying to get a virtual server running using Vagrant and VirtualBox. For the VirtualBox I'm using scotch/box which got all the basic stuff for running a ubuntu server with some components (apache, mysql, php etc.) more on scotchbox can be found here.
Now I got the server up and running (running a Yii2 application) but as soon as the application starts I get an Yii error message sh: 1: sass: not found and because of that a SASS file couldn't be converted to CSS. So I went back to my server to check if sass was installed, it wasn't so I ran the command gem install sass and after that sass was installed. gem list sass -i returned true.
But still the problem stayed, sass couldn't be found. I went back to my console and of course apache is ran by user www-data and I logged in to ssh with the vagrant user. And this is were it gets a bit vague for me. In the environments variables of the apache service I added the paths to both ruby and the gems. But still the www-data user cannot find the sass command or the gem command or even the ruby command.
I also tried to change the owner of the apache service from www-data to the vagrant user that did kinda help but thats not the solution I want to accept. I want a solution that the apache service stays owned by the www-data user and not a root user like vagrant.
If more data needs to be added please let me know.
Envvars file
envvars - default environment variables for apache2ctl
# this won't be correct after changing uid
unset HOME
# for supporting multiple apache2 instances
if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}"
else
SUFFIX=
fi
# Since there is no sane way to get the parsed apache2 config in scripts, some
# settings are defined via environment variables and then used in apache2ctl,
# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
# temporary state file location. This might be changed to /run in Wheezy+1
export APACHE_PID_FILE=/var/run/apache2/apache2$SUFFIX.pid
export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX
# Only /var/log/apache2 is handled by /etc/logrotate.d/apache2.
export APACHE_LOG_DIR=/var/log/apache2$SUFFIX
## The locale used by some modules like mod_dav
export LANG=C
## Uncomment the following line to use the system default locale instead:
#. /etc/default/locale
export LANG
## The command to get the status for 'apache2ctl status'.
## Some packages providing 'www-browser' need '--dump' instead of '-dump'.
#export APACHE_LYNX='www-browser -dump'
## If you need a higher file descriptor limit, uncomment and adjust the
## following line (default is 8192):
#APACHE_ULIMIT_MAX_FILES='ulimit -n 65536'
## If you would like to pass arguments to the web server, add them below
## to the APACHE_ARGUMENTS environment.
#export APACHE_ARGUMENTS=''
## Enable the debug mode for maintainer scripts.
## This will produce a verbose output on package installations of web server modules and web application
## installations which interact with Apache
#export APACHE2_MAINTSCRIPT_DEBUG=1
export GEM_HOME=/home/vagrant/.rvm/gems/ruby-2.1.3
export GEM_PATH=/home/vagrant/.rvm/gems/ruby-2.1.3:/home/vagrant/.rvm/gems/ruby-2.1.3#global
export MY_RUBY_HOME=/home/vagrant/.rvm/rubies/ruby-2.1.3
export IRBRC=/home/vagrant/.rvm/rubies/ruby-2.1.3/.irbrc
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Try to find out whether the PATH that apache uses is indeed modified by your adjustments of the envvars file. You could do this by simply putting running this php code:
var_dump(getenv("PATH"));
die;
I've had the exact same problem. After a long time trying it turned out that service apache2 stop and start in vagrant is not working as expected. After setting the PATH variable in /etc/apache2/envvars try reloading apache by reloading vagrant instead: vagrant reload

Not able to connect to atom.io for themes and packages

I believe my work proxy is preventing me from being able to add themes and packages to Atom. From the preferences menu, I get:
Fetching featured packages and themes failed. Hide output…
tunneling socket could not be established, cause=140499728967552:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:766:
Is it possible to make it use my $https_proxy variable? Is there some way to configure it to not use https?
You can configure your proxy settings in ~/.atom/.apmrc (or Atom\resources\app\apm\node_modules\atom-package-manager\.apmrc in Windows). Per the apm README:
If you are using a proxy you can configure apm to use it by setting the https-proxy config in your ~/.atom/.apmrc file like so:
https-proxy = https://9.0.2.1:0
It seems that as of Atom 1.0, there are some components that respect the http-proxy and https-proxy variables, and others that don't. For example, the initial check for the version of Atom works, but the check for packages doesn't seem to respect the http-proxy or https-proxy settings.
I was able to get Atom working with Fiddler as my proxy (on 127.0.0.1:8888) by running the following commands (on Windows):
apm config set proxy http://127.0.0.1:8888
apm config set strict-ssl false
I did not need to set http-proxy or https-proxy. I don't know if these settings have been deprecated or not, but they don't seem to work reliably in 1.0. The setting proxy works (and upgrades itself to TLS 1.2 automatically).
The entirety of my %USERPROFILE%\.atom\.apmrc file is:
strict-ssl=false
proxy=http://127.0.0.1:8888/
I was getting this error on Windows 7 fro Atom 1.0, when trying to look up packages.
In my case the issue was resolved by setting https-proxy variable to use http protocole instead of https. so both of the following parameters have exact same value.
here are the values from ~.atom.apmrc file
proxy=http://[host]:[port]/
https-proxy=http://[host]:[port]/
the answer by #NYCdotNet below that suggested to use
strict-ssl=false
didn't work as i was able to lookup some packages but installation failed with timeout error from GIT.
Atom will use your shell's proxy variables (like $https_proxy) if you start Atom from a shell that has these variables set. You need to have the Atom command line tools installed for that to work.
From a shell, you can simply type atom to open the editor for the current directory. It will use all environment variables from this shell, including the proxy variables.
I find this a lot easier than setting the variables in the config file.
I edited the ~/.atom/.apmrc file to set my proxy as mentioned by #AlexMooney, but still got errors.
The solution was to write
proxy = http://host:port
strict-ssl = false
in that ~/.atom/.apmrc file.
For Windows you can easily configure the https-proxy via command line:
amd config set https-proxy https://9.0.2.1:0
It should be stored under C:\Users\...\.apm in file .apmrc
See userconfig with command
amd config list
To config Proxy for Atom to install new pakage, just open CMD and run these commands:
apm config set strict-ssl false
apm config set proxy your_proxy
apm config set your_proxy
I am working behind a proxy server and spent about half a day on this issue, setting https_proxy as well as http_proxy didn't make a difference.
What did it for me was setting the proxy from the cmd line like so:
apm config set proxy http://myproxyaddress:port
I still can't install packages through Atom's gui, but doing it through the cmd line works fine. That I'll take.
I later realised I could've switched to the wifi and got it to work immediately...

GitExtensions - OpenSSH ignores ~/.ssh/config file

Using gitextensions I try to clone my remote repository which results in gitextensions running the following command
> C:\cygwin\bin\git.exe clone -v --recurse-submodules --progress "gitbox:/projects/testing.git" "C:/Users/craig/MyCode/Personal/testing"
which fails with
Permission denied (publickey).
However if I run the exact same command from a cygwin bash shell it succeeds. So in addition to a standard configuration I also have a ~/.ssh/config which sets up the 'gitbox' alias for ease of use.
My ~/.ssh/config file looks like this
# My GitBox -
Host gitbox
Hostname mydomain.com
User git
IdentityFile /home/craig/.ssh/craig#home
Port 2022 # i.e non-standard port
In GitExtensions I have the OpenSSH option checked, and I also have HOME set to where my cygwin installation is, and more specifically where the user account ie c:/cygwin/home/craig
My conclusion is that somehow the ~/.ssh/config file is not being read and utilised. Everything I can find indicates that an incorrect HOME directory in gitextensions would be the problem but I can't see what's up with my setup.
Thanks in advance
Craig
GitExtensions by default set HOME variable to "C:\Users\". You can change this in settings dialog.

Resources