SSH通过X11协议在Linux服务器运行GUI程序

Kevin 教程 3,173 次浏览 93条评论

最近在VPS上用到的一个GUI程序,没想到在无桌面环境下的Linux系统也能运行。网上搜索了解了一番,其原理是通过X11协议实现的,需要在本机及服务器两端安装软件支持。下面演示下运行方法。

SSH客户端配置

SSH客户端不能直接呈现图形界面,需要安装Xming软件配合。

安装后在开始菜单程序文件夹里打开XLaunch,设置依次默认下一步,直到这个界面勾选NO ACCESS CONTROL选项保存退出。

XmingNo Access Control

之后打开SSH客户端会话设置,勾选X11转发选项。笔者这里用的是SecureCRT。PuTTY设置里也有相关选项。Xshell未测试,据说要安装Xmanager。

Forward X11 Packets

到此SSH客户端设置完成。如果你没用上面SSH客户端,可以使用MobaXterm,它内置X11支持。

服务器配置

先交代服务器环境为CentOS 7 x64(Minimal)。如果直接运行GUI程序,通常会有如下报错。

[root@test ~]# ./FileName
./FileName: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory

这个问题可以通过yum install -y gtk2解决。

再次运行提示Gtk-WARNING **: cannot open display错误,需要安装X11相关软件。

yum install -y xorg-x11-xauth xorg-x11-fonts-* xorg-x11-font-utils xorg-x11-fonts-Type1

之后再修改/etc/ssh/sshd_config文件,确保下面两个参数值改为如下。

X11Forwarding yes
X11UseLocalhost no

systemctl restart sshd刷新SSH配置文件,退出终端重新登录。

重新登录有个/root/.Xauthority文件缺失错误,不用理会,它会自动创建,下次登录就不会提示。

运行GUI程序

运行个GUI程序试试,例如xclock时钟。先yum install -y xclock安装,然后运行xclock命令。

如无意外,就会显示图形界面了(记得先打开之前安装的Xming程序)。

Linux xclock

再运行个Chromium浏览器测试,用下面命令安装,然后chromium-browser --no-sandbox命令运行。

yum install epel-release
yum -y install chromium

Linux Chromium

如果程序界面里的文字显示乱码,运行下面命令安装字体重试。

yum install -y dejavu-sans-mono-fonts wqy-zenhei-fonts

参考及延伸资料:

  • https://zeroto.one/2018/08/13/linux_x11_config/
  • https://www.cnblogs.com/tsfh/p/9022170.html
  • http://blog.creke.net/810.html

评论列表

  1. #1

    Hi, very nice website, cheers!
    ——————————————————
    Need cheap and reliable hosting? Our shared plans start at $10 for an year and VPS plans for $6/Mo.
    ——————————————————
    Check here: https://www.reliable-webhosting.com/

  2. #2

    generic bimatoprost samples https://carepro1st.com/

  3. #3

    naltrexone webmd https://naltrexoneonline.confrancisyalgomas.com/

  4. #4

    active ingredients in hydroxychloroquine https://hhydroxychloroquine.com/

  5. #5

    ivermectin pills instruction https://ivermectin.mlsmalta.com/

  6. #6

    dapoxetine citrate for sale https://salemeds24.wixsite.com/dapoxetine

  7. #7

    hydroxychloroquine dosage for coronavirus https://hydroxychloroquine.webbfenix.com/

  8. #8

    which is better viagra levitra or vidalista https://vidalista40mg.mlsmalta.com/

  9. #9

    online doctors prescribe pain medications https://buymeds.mlsmalta.com/

  10. #10

    chewable tadalafil https://wisig.org/

  11. #11

    what dosage of hydroxychloroquine for covid https://hydroxychloroquinee.com/

  12. #12

    best price for priligy https://ddapoxetine.com/

  13. #13

    difference between albuterol and proair https://amstyles.com/

  14. #14

    alternatives to prednisone for asthma https://prednisone.bvsinfotech.com/

  15. #15

    compare cialis prices https://www.lm360.us/

  16. #16

    professional generic viagra 100mg https://viaplz.com/

  17. #17

    cenforce 200 sildenafil citrate reviews http://droga5.net/

  18. #18

    hydroxychloroquine for covid 19 dosage https://hydroxychloroquine.wisig.org/

  19. #19

    hydroxychloroquine for covid 19 dosage https://hydroxychloroquine.grassfed.us/

  20. #20

    instant approval loans

  21. #21

    kamagra uk paypal

  22. #22

    prozac pill

  23. #23

    vardenafil cost canada

  24. #24

    microloans

  25. #25

    viagra 100mg cost in usa

  26. #26

    need a loan immediately

  27. #27

    payday loan sites

  28. #28

    loan without a job

  29. #29

    how long does cialis last https://cialis.advantagetriseal.com/

  30. #30

    how long does cialis last https://cialis.grassfed.us/

  31. #31

    generic viagra online paypal

  32. #32

    loans unsecured

  33. #33

    flomax otc

  34. #34

    instant personal loan approval

  35. #35

    payday advance lenders

  36. #36

    generic viagra paypal canada

  37. #37

    canadian pharmacy tadalafil

  38. #38

    negative effects of cialis https://cialis.mlsmalta.com/

  39. #39

    negative effects of cialis https://cialis.webbfenix.com/

  40. #40

    Fastidious answers in return of this matter with solid arguments and
    explaining all concerning that.

    my web site: google

  41. #41

    Thanks in favor of sharing such a nice thought, post is nice, thats why i have read it fully

    Feel free to surf to my website – download albums free zip (Virgilio)

  42. #42

    Hello there, You’ve done an excellent job. I’ll definitely digg it and
    personally recommend to my friends. I’m sure they’ll be benefited from this site.

    Here is my site google

  43. #43

    I seriously love your website.. Very nice colors & theme.
    Did you develop this amazing site yourself? Please reply back as I’m trying to create my very own website and
    would love to find out where you got this from or what the theme is named.
    Many thanks!

    Feel free to visit my blog hurdacı istanbul

  44. #44

    pour on stromectol https://ivermectin1st.com/

  45. #45

    Thank you for every other informative web site. The place else may just I am getting that kind of info written in such an ideal method?
    I have a venture that I am just now working on, and I have been at the glance out for such information.

    Feel free to visit my blog – security guards wigan

  46. #46

    Neat blog! Is your theme custom made or did you download it from somewhere?
    A design like yours with a few simple tweeks
    would really make my blog jump out. Please let me know where you got your design.
    Many thanks

    my web blog :: riverwalk apartments philly (Catharine)

  47. #47

    whoah this weblog is wonderful i like studying your posts.

    Stay up the good work! You understand, lots of individuals
    are looking around for this info, you could aid them greatly.

    Feel free to surf to my blog post :: Ayurvedic Massage in Sharjah

  48. #48

    Link exchange is nothing else however it is just
    placing the other person’s webpage link on your page at
    appropriate place and other person will also do same in support of you.

    Feel free to visit my blog: water wave virgin hair

  49. #49

    It’s hard to search out knowledgeable people on this matter, however you sound like you know what you’re talking about! Thanks

    http://www.vreyrolinomit.com/

  50. #50

    Fantastic post but I was wondering if you could write a litte more on this topic?
    I’d be very grateful if you could elaborate a little bit
    more. Many thanks!

    my page: New South Wales Fake Driver licence

  51. #51

    I just like the helpful information you supply in your articles.
    I’ll bookmark your weblog and take a look at
    once more right here frequently. I’m relatively sure I’ll be informed many new stuff proper here!
    Good luck for the next!

    Feel free to visit my web page; Herman Miller (Mattie)

  52. #52

    Right here is the right blog for anybody who really wants to understand
    this topic. You know a whole lot its almost hard to argue
    with you (not that I really will need to…HaHa).
    You definitely put a new spin on a subject that has been written about for many years.
    Excellent stuff, just excellent!

    my site; office furniture liquidation

  53. #53

    I’m truly enjoying the design and layout of your blog.
    It’s a very easy on the eyes which makes it much more pleasant for me
    to come here and visit more often. Did you hire out a designer to
    create your theme? Fantastic work!

    my page: Brake Replacement (marketing-agency58158.is-blog.com)

  54. #54

    This piece of writing will help the internet users for
    creating new weblog or even a weblog from start to end.

    Feel free to visit my web-site :: كشف منزلي

  55. #55

    Wow, amazing blog layout! How long have you been blogging
    for? you made blogging look easy. The overall look of your web site
    is wonderful, as well as the content!

    my web blog :: scheduling a road test (http://jeffreydytmg.blue-blogs.com/3383819/driving-license-exams-choosing-the-greatest-online-instruction-service-provider)

  56. #56

    Hello there, You’ve done a fantastic job.
    I’ll certainly digg it and personally recommend to my friends.
    I am confident they’ll be benefited from this web site.

    Here is my webpage :: Online delivery sri lanka (Hector)

  57. #57

    Link exchange is nothing else however it is simply placing the other person’s web
    site link on your page at appropriate place and other person will
    also do similar in support of you.

    Look into my webpage … property development loans

  58. #58

    I feel that is one of the so much important info for me.
    And i’m glad studying your article. However should statement on some general issues, The website style is
    perfect, the articles is truly nice : D. Excellent
    process, cheers

    Stop by my page; furniture in kuwait

  59. #59

    Sweet blog! I found it while searching on Yahoo News.
    Do you have any tips on how to get listed in Yahoo News?

    I’ve been trying for a while but I never seem to get there!
    Cheers

    Feel free to surf to my page: check my blog; Katherine,

  60. #60

    I always spent my half an hour to read this
    blog’s posts daily along with a mug of coffee.

    Here is my blog post :: best xmind alternative

  61. #61

    I have been exploring for a little for any high quality
    articles or blog posts on this kind of house .
    Exploring in Yahoo I eventually stumbled upon this web site.
    Reading this info So i’m glad to exhibit that I have an incredibly just right uncanny feeling
    I came upon just what I needed. I so much undoubtedly will make certain to do not forget
    this website and provides it a look on a relentless basis.

    Feel free to visit my web page – RC Truck Trial Unimog (writeablog.net)

  62. #62

    I’m impressed, I have to admit. Seldom do I come across a blog that’s equally educative and interesting, and let me tell you, you’ve hit the nail on the head.
    The problem is something that too few folks are speaking intelligently about.
    I’m very happy that I came across this in my hunt for something regarding this.

    Have a look at my web blog – Bangladesh Newspapers (Juan)

  63. #63

    Nice weblog here! Also your web site rather a lot up fast!
    What web host are you the use of? Can I get your associate hyperlink on your host?
    I desire my site loaded up as quickly as yours lol

    Here is my homepage Loft Conversions Rochdale

  64. #64

    If you wish for to obtain much from this article then you have to apply these techniques to
    your won webpage.

    My web blog – Assistencia (http://www.assist24.pt)

  65. #65

    I have been browsing online more than 4 hours today,
    yet I never found any interesting article like yours.
    It is pretty worth enough for me. In my view, if all web owners and bloggers made good
    content as you did, the internet will be a lot more useful than ever before.

    My webpage :: HP indonesia (http://internet-marketing-compan73849.loginblogin.com/3599393/benefits-of-using-a-mobile-phone-skin)

  66. #66

    Do you have any video of that? I’d love to find out some additional information.

    Take a look at my web-site: Homes for sale in Saratoga Springs
    NY (Shelley)

  67. #67

    There’s certainly a great deal to learn about this topic.
    I love all the points you made.

    Here is my web page :: self help

  68. #68

    Howdy just wanted to give you a quick heads up.
    The words in your article seem to be running off the screen in Ie.
    I’m not sure if this is a format issue or something to do with web browser compatibility but I thought
    I’d post to let you know. The style and design look great though!

    Hope you get the problem solved soon. Thanks

    Here is my page … radiator core

  69. #69

    Appreciate the recommendation. Let me try it out.

    Feel free to surf to my blog :: replica designer shoes [Eileen]

  70. #70

    cialis brand online http://edbuy.online/

  71. #71

    I could not refrain from commenting. Well written!

    Feel free to surf to my webpage … Ammie Vahle

  72. #72

    Hi, of course this post is in fact fastidious and I have
    learned lot of things from it concerning blogging. thanks.

    Feel free to visit my web blog Chaya Palencia

  73. #73

    Hello there, just became alert to your blog through Google,
    and found that it’s really informative. I’m gonna watch out
    for brussels. I’ll be grateful if you continue this in future.
    A lot of people will be benefited from your writing. Cheers!

    Look at my web site; Teressa Fenimore (Dana)

  74. #74

    I like what you guys are up too. Such smart work and reporting! Carry on the excellent works guys I’ve incorporated you guys to my blogroll. I think it’ll improve the value of my web site 🙂

    http://www.zortilonrel.com/

  75. #75

    Thanks designed for sharing such a pleasant idea, paragraph is fastidious, thats why i have
    read it fully

    My web-site – Rodger Romanik

  76. #76

    Truly when someone doesn’t know after that its up to other people that they will help,
    so here it occurs.

    Also visit my webpage Keshia Dake; http://stocks.newsok.com/,

  77. #77

    I’m not sure why but this weblog is loading
    extremely slow for me. Is anyone else having this issue or is it a
    problem on my end? I’ll check back later on and see if the problem still exists.

    Feel free to surf to my web blog; Merle Landes

  78. #78

    It’s hard to come by educated people about this topic, but you sound
    like you know what you’re talking about! Thanks

    Visit my web blog; grill kabob express manassas va

  79. #79

    Excellent post. I was checking continuously this blog and I’m impressed!
    Very helpful information specifically the last part 🙂 I care for such info a lot.
    I was seeking this certain info for a long time. Thank you and good luck.

    Here is my web page – grill dinner ideas

  80. #80

    me encantei com este site. Para saber mais detalhes acesse nosso site e descubra mais. Todas as informações contidas são informações relevantes e únicos. Tudo que você precisa saber está está lá.

    https://corporality.global/

  81. #81

    I got this web page from my friend who told me concerning
    this web page and now this time I am browsing this web site
    and reading very informative articles at this time.

    my blog … Araceli Gibby

  82. #82

    Greetings! Very helpful advice within this article!

    It is the little changes which will make the largest changes.

    Thanks a lot for sharing!

    Also visit my web page; Erna Stoney

  83. #83

    Yes! Finally something about artigianato sardo.

    Visit my web-site artigianato in costa smeralda; artigianatopasella30.tearosediner.net,

  84. #84

    Have you ever considered writing an ebook or guest authoring on other sites?
    I have a blog based on the same subjects
    you discuss and would really like to have you share some
    stories/information. I know my audience would appreciate your work.

    If you’re even remotely interested, feel free to send
    me an e mail.

    Also visit my page :: Leena Heaston

  85. #85

    WOW just what I was searching for. Came here by searching
    for Sandee Mensch

    Also visit my web site – Lasandra Corkery (https://meet-wiki.win/index.php/20_Insightful_Quotes_About_Tech_Meozia)

  86. #86

    Just wish to say your article is as surprising.
    The clarity in your post is just great and i could assume
    you are an expert on this subject. Well with your permission allow me to grab your
    feed to keep updated with forthcoming post. Thanks a million and please carry on the gratifying work.

    my web site Chase Demario

  87. #87

    Hello, i feel that i noticed you visited my website thus i got here to return the desire?.I’m
    trying to in finding things to enhance my site!I suppose its good enough to make use of a few of your concepts!!

    My web blog – Britt Zawacki (articlescad.com)

  88. #88

    After study a couple of of the weblog posts on your website now, and I actually like your means of blogging. I bookmarked it to my bookmark website checklist and will likely be checking back soon. Pls take a look at my website as properly and let me know what you think.

    https://www.youtube.com/watch?v=_bPSWABggX8

  89. #89

    What’s up to every single one, it’s in fact a pleasant for me to pay a
    visit this site, it includes helpful Information.

    Here is my website – Fitness Clothing and Supplements to help you reach your fitness goals (Jayme)

  90. #90

    Hello There. I found your blog the use of msn. This is
    a very neatly written article. I will be sure
    to bookmark it and return to read extra of your useful info.
    Thanks for the post. I’ll definitely return.

    Feel free to surf to my blog post :: Fitness Clothing and Supplements
    to help you reach your fitness goals – brooksfxndt.activosblog.com

  91. #91

    Hi, the whole thing is going well here and ofcourse every one is sharing information, that’s genuinely good, keep
    up writing.

    Here is my web page: interior design

  92. #92

    I every time emailed this webpage post page to
    all my friends, because if like to read it then my
    links will too.

    Here is my website custom barn doors

  93. #93

    I adore assembling useful info, this post has got me even more info! .

    http://www.vreyrolinomit.com/

发表评论

电邮地址用于 Gravatar 头像显示,不会被公开可见。