How to access remotely PgAdmin4? - pgadmin-4

I Try access pgAdmin4 via browser instaled in another Notebook with Linux Ubuntu 16.04 in the same network in my house, but not access.
In localhost... Ok
But REMOTELY... DOES NOT ACCESS

You need to add the following config options:
DEFAULT_SERVER = '0.0.0.0'
in config_local.py (in "pgAdmin4" folder).
If you also want to change the default port then also add
DEFAULT_SERVER_PORT = 5050

First change the line in config.py from DEFAULT_SERVER = '127.0.0.1' to DEFAULT_SERVER = '0.0.0.0'
Config.py is located in the same directory as pgAdmin4:
sudo find / -name "*pgAdmin4"
Start pgAdmin4 in the same directory (use tmux or as service to keep in background):
sudo python3 pgAdmin4.py
If you don't know the login, you can delete/move this file and restart pgAdmin.py:
sudo find / -name "*pgadmin4.db"
This should work on both Ubuntu Server and Desktop. You should preferably keep the 127.0.0.1 and use nginx or Apache in front.

Weird enough, in my case I have to manually run the command
$ pgadmin4
and then the dashboard will be presented in the default browser automatically.

It seems you are trying to open pgadmin client at server.
I suggest you to install pgadmin client from where you want to connect this , add server in pgadmin and do connect.

Tested on ubuntu 20.04
apt install pgadmin4-apache2
nano /usr/share/pgadmin4/web/config.py
Change 127.0.0.1 by 0.0.0.0
Don't forget to copy the key in the shell when you launch pgadmin4 in the remote web browser by replacing 127.0.0.1 by pgadmin4 host IP
E.G. : Something like this in your remote web-browser
http://192.168.1.56:43223/?key=5f45c8ee-4593-41d0-9ae1-06d6dd1d8280
PS : If you don't find config.py
apt install mlocate
updatedb
locate pgadmin4 | grep config.py$
All commands are in root don't forget sudo if you are not root

On macOS, I figured out that pgAdmin 4 web interface uses the port 61886.
Try to access it using http://localhost:61886/browser.
If not, run the command netstat -atp tcp | grep -i "listen" and check what ports are listening.

Related

How to connect superset to postgresql - The port is closed

My operating system is Linux.
I am going to connect Superset to PostgreSQL.
PostgreSQL port is open and its value is 5432.
PostgreSQL is also running and not closed.
Unfortunately, after a day of research on the Internet, I could not solve the problem and it gives the following error:
The port is closed.
Database port:
command: lsof -i TCP:5432
python3 13127 user 13u IPv4 279806 0t0 TCP localhost:40166->localhost:postgresql (ESTABLISHED)
python3 13127 user 14u IPv4 274261 0t0 TCP localhost:38814->localhost:postgresql (ESTABLISHED)
Please help me, I am a beginner, but I searched a lot and did not get any results.
Since you're running Superset in a docker container, you can't use 127.0.0.1 nor localhost, since they resolve to the container, not the host. For the host, use host.docker.internal
I had a similar problem using docker compose. Port is closed can be due to networking problem. Host.docker.internal doesn’t worked for me on Ubuntu 22. I would like to recommend to not follow official doc and use better approach with single docker image to start. Instead of running 5 containers by compose, run everything in one. Use official docker image, here image. Than modify docker file as follows to install custom db driver:
FROM apache/superset
USER root
RUN pip install mysqlclient
RUN pip install sqlalchemy-redshift
USER superset
Second step is to build new image based on docker file description. To avoid networking problems start both containers on same network (superset, your db) easier is to use host network. I used this on Google cloud example as follow:
docker run -d --network host --name superset supers
The same command to start container with your database. —network host. This solved my problems. More about in whole step to step tutorial: medium or here blog
From the configuration file, you set port 5432, but it does not mean that your pg service is available

VMware Player-15 install vmware tools

Installed a new vmware player 15.5.1 on win10 pro, using guest linux/unbuntu 18.04 server
Trying to get to install the vmware tools (not sure what options I may have selected when I installed the work station). But the install vmware tools menu is disabled. When I run my VM get the re-install menu that too is disabled.
Tried manual install of vmware tools - but that also did not do the trick:
apt-get install open-vm-tools
apt-get install open-vm-tools-desktapop
systemctl status open-vm-tools
sudo shutdown -r now
ps | grep vmtoolsd
How do I fix this. (just start over with fresh install and all that or try use some other player (!?))
I did not get any response here and could not figure it out - tried many options. (same problem with VirtualBox)
But the good news, at least from cut-n-paste perspective- use alternate client. You can use ssh to login into the machine using your favorite tool - putty or even cmd will work. This actually is a better solution - no need to muck with mouse capture and all that.
So just setup a ssh server
sudo apt update
sudo apt install openssh-server
sudo systemctl status ssh
Active: active (running)
Open firewall
sudo ufw allow ssh
Check IP address
ip a
SSH in with PUtty or Cmd or ..
ssh username#ip_address
You are Done - will work like a charm
Note: This ssh works only from local host as the VM only has Pvt IP. If you can create public IP on VM (that is another arduous adventure - still working on it) - you will be able to remote ssh

How to enable rdp service on manjaro?

I need login to manjaro from windows.
I found that on ubuntu or else xrdp is used, but not found on manjaro. sudo pacman -S xrdp wont work.
xrdp is in aur: https://aur.archlinux.org/packages/xrdp/
You could run for example yay -S xrdp
you can install remmina from snap store, no need to aur
sudo snap install remmina
Remmina supports multiple network protocols in an integrated and consistent user interface. and currently RDP, VNC, SPICE, NX, XDMCP, SSH and WWW are supported.
here is the link to snap store : snapstore/remmina

Connect to docker sqlserver via ssh

I've created a docker container that contains a mssql Database. On the command line ip a gives an ip address for the container, however trying to ssh into it username#docker_ip_address yields ssh: connect to host ip_address port 22: Connection refused. So I'm wondering if I am even able to ssh into the container so I don't have to always be using the docker tool docker exec .... and if so how would I go about doing that?
To ssh into container you should full-fill followings
SSH server(Openssh) should be installed within the container and ssh service should be running
Port 22 should be published from container (when you run the container).more info here > Publish ports on Docker
docker ps command should display mapped ports 22
Hope above information helps for you to understand the situation...
If your container contains a database server, the normal way to interact with will be through an SQL client that connects to it; Google suggests SQL Server Management Studio and that connector libraries exist for popular languages. I'm not clear what you would do given a shell in the container, and my main recommendation here would be to focus on working with the server in the normal way.
Docker containers normally run a single process, and that's normally the main server process. In this case, the container runs only SQL Server. As some other answers here suggest, you'd need to significantly rearchitect the container to even have it be possible to run an ssh daemon, at which point you need to worry about a bunch of other things like ssh host keys and user accounts and passwords that a typical Docker image doesn't think about at all.
Also note that the Docker-internal IP address (what you got from ip addr; what docker inspect might tell you) is essentially useless. There are always better ways to reach a container (using inter-container DNS to communicate between containers; using the host's IP address or DNS name to reach published ports from the same or other hosts).
Basically, alter your Dockerfile to something like the following - that will install openssh-server, alter a prohibitive default configs and start the service:
# FROM a-image-with-mssql
RUN echo "root:toor" | chpasswd
RUN apt-get update
RUN apt-get install -y openssh-server
COPY entrypoint.sh .
RUN cd /;wget https://gist.githubusercontent.com/spekulant/e04521d6c6e1ccffbd3455c673518c5b/raw/1e4f6f2cb32caf3a4a9f73b02efdcbd5dde4ba7a/sshd_config
RUN rm /etc/ssh/sshd_config; cp sshd_config /etc/ssh/
ENTRYPOINT ["./entrypoint.sh"]
# further commands
Now you've got yourself an image with ssh server inside, all you have to do is start the service, you cant do RUN service ssh start because it won't work - docker specifics, refer to the documentation. You have to use a Entrypoint like the following:
#!/bin/bash
set -e
sh -c 'service ssh start'
exec "$#"
Put it in a file entrypoint.sh next to your Dockerfile - remember to chmod 755 entrypoint.sh it. There's one thing to mention here, you still wouldn't be able to ssh into the container - the default SSH server configuration doesn't allow login into root account using a password. So you either change the configs yourself and provide it to the image, or you can trust me and use the file I created - inspect it with the link from Dockerfile - nothing malicious there, only a change from prohibit-password to yes.
Fortunately for us - MSSQL official images start from Ubuntu so all the commands above fit perfectly into the environment.
Edit
Be sure to ask if something is unclear or I'm jumping too fast.

Could not reliably determine the server's fully qualified domain name

I have just installed Apache 2.2.17, and I am using it for the first time.
Now when I try to start the server using the command service httpd start it gives me the message:
httpd: Could not reliably determine the server's fully qualified domain name, using ::1 for ServerName
Now I think I have to set ServerName and the IP address as I search through Google. But I don't know in which file I have to set.
How can I fix this problem?
sudo vim /etc/apache2/httpd.conf
Insert the following line at the httpd.conf: ServerName localhost
Just restart the Apache: sudo /etc/init.d/apache2 restart
Yes, you should set ServerName:
http://wiki.apache.org/httpd/CouldNotDetermineServerName
http://httpd.apache.org/docs/current/mod/core.html#servername
You can find information on the layouts used by the various httpd distributions here:
http://wiki.apache.org/httpd/DistrosDefaultLayout
In your case the file to edit is /etc/httpd/conf/httpd.conf
I was NOT getting the ServerName wrong. Inside your VirtualHost configuration that is causing this warning message, it is the generic one near the top of your httpd.conf which is by default commented out.
Change
#ServerName www.example.com:80
to:
ServerName 127.0.0.1:80
Under Debian Squeeze;
Edit Apache2 conf file : vim /etc/apache2/apache2.conf
Insert the following line at the apache2.conf: ServerName localhost
Restart Apache2: apache2ctl restart or /etc/init.d/apache2 restart
Should work fine (it did solve the problem in my case)
tks noodl for the link on the different layouts. :)
sudo nano /etc/apache2/httpd.conf
search for a text ServerName in nano editor <Ctrl + W>
Insert the following line at the httpd.conf: ServerName localhost
Just restart the Apache: sudo /usr/sbin/apachectl restart
Another option is to ensure that the full qualified host name (FQDN) is listed in /etc/hosts.
This worked for me on Ubuntu v11.10 without having to change the default Apache configuration.
" To solve this problem You need set ServerName.
1: $ vim /etc/apache2/conf.d/name
For example set add ServerName localhost or any other name:
2: ServerName localhost
Restart Apache 2
3: $ service apache restart
For this example I use Ubuntu 11.10.1.125"
FQDN means the resolved name over DNS. It should be like "server-name.search-domain".
The warning you get just provides a notice that httpd can not find a FQDN, so it might not work right to handle a name-based virtual host. So make sure the expected FQDN is registered in your DNS server, or manually add the entry in /etc/hosts which is prior to hitting DNS.
If you are using windows there is something different sort of situation
First open c:/apache24/conf/httpd.conf.
The Apache folder is enough not specifically above path
After that you have to configure httpd.conf file.
Just after few lines there is pattern like:
#Listen _____________:80
Listen 80
Here You have to change for the localhost.
You have to enter ipv4 address for that you can open localhost.
Refer this video link and after that just bit more.
Change your environment variables:
In which you have to enter path:
c:apache24/bin
and
same in the SYSTEM variables
If any query feel free to ask.
Two things seemed to do it for me:
Put all aliases for 127.0.0.1 in /etc/hosts in a single line (e.g. 127.0.0.1 localhost mysite.local myothersite.local
Set ServerName in my httpd.conf to 0.0.0.0 (localhost or 127.0.0.1 didn't work for me)
Editing /etc/hosts got rid of long response times and setting the ServerName got rid of OP's warning for me.
who are still couldnt resolve the problem and using mac then follow this
1.goto the root folder /
cd usr/local/etc/apache2/2.4
3.sudo nano httpd.conf
4.change #servername to ServerName 127.0.0.1:8080 press ctrl+o,+return+ctrl x
5.then restart the server apachectl restart
If you are using windows, remove comment on these lines and set them as:
Line 227 : ServerName 127.0.0.1:80
Line 235 : AllowOverride all
Line 236 : Require all granted
Worked for me!
Here's my two cents. Maybe it's useful for future readers.
I ran into this problem when using Apache within a Docker container. When I started a container from an image of the Apache webserver, this message appeared when I started it with docker run -it -p 80:80 my-apache-container.
However, after starting the container in detached mode, using docker run -d -p 80:80 my-apache-container, I was able to connect through the browser.
I am using ubuntu 22.04
I installed the apache2 at the location '/usr/local/apache2'
I just edited the '/usr/local/apache2/conf/httpd.conf' file.
run the following commands
cd /usr/local/apache2/conf
sudo nano httpd.conf
find this comment
#ServerName www.example.com:80, in my case it is at line 197
after that add this
ServerName localhost
don't modify anything else in this file!
Thank you!

Resources