I have recently set up Xvfb on Centos 7 machine.

It is working absolutely fine.

Only problem is that if I quit putty session (remote access) it would keep running Xvfb in background but display will be gone.

So next time when I take remote access via putty first I have to type export DISPLAY=:99 again, then I start my tests.

How can I make it permanent? I don't see solution to my problem in this thread How to make exported shell variables permanent?

Update: .profile contents:

export M3_HOME=/home/aditi.a/apache-maven-3.5.4/bin
export PATH=$PATH:$M3_HOME

export JMETER_HOME=/home/aditi.a/apache-jmeter-5.0/bin

export JAVA_HOME=/usr/java/jdk1.8.0_192-amd64
export PATH=$PATH:$HOME/bin:$JAVA_HOME/bin

export DISPLAY=:99

echo variables output:

$ echo $JAVA_HOME
$ echo $M3_HOME
$ echo $DISPLAY


which shell I am running

$ ps -p $$
  PID TTY          TIME CMD
30678 pts/14   00:00:00 sh
  • Welcome to U&L! Which of the answers from the linked question have you tried? – JigglyNaga Oct 30 '18 at 10:12
  • I have added this line export DISPLAY=:99 in .profile file where JAVA, MAVEN environment variables are saved. Quit putty session and ran the tests, tests failed because display wasnt there, exported the display again and test run fine this time – Aditi Apte Oct 30 '18 at 10:47
  • 1
    Which shell are you using? Some shells will only read ~/.profile as a fallback, if some other startup file isn't present. – JigglyNaga Oct 30 '18 at 10:57
  • Do you mean in order to get permanently running the display this is the correct way?. To answer question, I am sure that it is the correct .profile file because it is reading Maven, Jmeter, Java from there perfectly. – Aditi Apte Oct 30 '18 at 17:29
  • 1
    I also asked you to confirm that the other variables in there are set as expected: When you've connected via putty, and you type echo $JAVA_HOME, or echo $M3_HOME, or echo $DISPLAY, what is the result? – JigglyNaga Oct 31 '18 at 7:41

I second what @JigglyNaga said, there is nothing wrong/missing after looking at your .profile file.

Only thing I would suggest copy same contents at

/home/aditi.a/.profile and .bashrc
/root/.profile and .bashrc files

| improve this answer | |
  • This worked. I quit putty launched again and ran tests, it run fine this time. – Aditi Apte Oct 31 '18 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.