For X11 forwarding, do both the local and remote systems have to run an X server?
Can I do X11 forwarding if my remote machine is in:
runlevel 3, meaning that no X server is running?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
You only need to run the X server on your client PC where you want see the GUI/Desktop. Typically this would be on your Windows PC in most environments ofcourse you could run it on a Linux/Mac workstation to. Point is the X Server itself must run on the client pc. The Linux server needs SSH along with the X Window System installed from packages, usually it is by default. The best client software I've seen to do this is MobaXTerm. MobaXTerm is a terminal client that runs an X Server on your client PC. The cool thing about MobaXTerm is it does the X Server for you along with exports the variables when you ssh to a server, it usually just works.
A tip though, if you login to a server using a terminal client such as MobaXTerm if you su, sudo, and/or switch users you loose the environment variable named DISPLAY=hostname:X.X which is required for this to work.
To install X Window software on Linux server at least CentOS/RHEL environments, others are probably similar you can check for the following.
yum groupinfo "X Window System" yum groupinstall "X Window System"
Then update /etc/ssh/sshd_config to enable X11 Forwarding for SSH then restart your sshd service.