很多兄弟肯定不只一个电脑,同时操作两个电脑频繁的切换鼠标键盘,肯定会让人很不爽吧,呵呵。这里总结一个教程,让一套鼠标键盘同时控制两个电脑,当然三四个电脑同样可以的。
1. ubuntu 下安装:
sudo apt-get install synergy
这个是命令行的,之后装一下这个可视化软件:
sudo apt-get install quicksynergy
2. windows下安装:
我没有windows系统,这里是官网,windows和ubuntu也是可以共享的。
http://synergy-foss.org/zh/xiazai/
安装成功之后:
1. 两个ubuntu系统共享方法:
1.服务端
在你的服务端 Applications->QuickSynergy
在你想让鼠标移到客户端的方向上添加客户端电脑的hostname(不知道的hostname的可以在终端输入hostname查一下);
服务端完毕,点击execute。
2. 客户端
在你的客户端Applications->QuickSynergy
在user这里输入你的服务端的ip/hostname,点击execute
2. ubuntu系统和window系统共享方法:
方法同样,有问题的同学,可以在下面留言,我会尽快帮助你的。
另外附上一个网上找的一篇英文文档,分享给大家:
Synergy is a program that will let you use one keyboard and mouse on
multiple computers across a network. The computers can be running Linux,
Windows, or MacOS. The computer with the keyboard and mouse is theserver or host, and the computers with the displays to be controlled remotely are the clients. In this HOWTO I will let you know how to get Synergy setup and running on your Ubuntu system.
Warning! Achtung! Synergy is not very secure at all! Consider – you are setting up something to allow an entirely different computer control the keyboard and mouse on your own computer! Don’t try and use this anywhere unsecure! There is a way of making it more secure by running it over OpenSSH, but that is currently beyond the scope of this article. More documentation is available on the Synergy website.
Here is a sample configuration that will be the needs of 95% of users:
You should now be able to move your mouse pointer off the right edge of your server’s screen and see it show up at the left side of your client’s screen. See the steps in the next section to make synergy start automatically on the host and client computers.
If you have any problems at this point it is helpful to run synergys and synergyc in the foreground with the -f option. This allows you to see error/status information that synergy prints to the terminal.
Go to System Menu > Preferences > Startup Applications. Click “Add” and enter
synergys
If you want to use the configuration setup with QuickSynergy use this instead:
synergys -c ~/.quicksynergy/synergy.conf
Click OK and Close.
Go to System Menu > Preferences > Startup Applications. Click “Add” and enter
synergyc <SERVER HOSTNAME>
Replacing <SERVER HOSTNAME> with either the hostname or IP address of myserver.
Click OK and Close.
To make sure synergy is running at all times, the following has to happen: First, synergy is started when the GDM login screen starts. Then, synergy is killed and restarted when a user logs in. When the user logs out, synergy is killed and GDM starts it again. To edit system configuration files in the following sections open a text editor as the root user:
NOTE: If your system has been configured to login automatically, this step may cause ubuntu to hang right before going to the desktop. If this is the case, remove these lines from /etc/gdm/Init/Default and everything should work properly. If your system is hanging at this stage, you can hit CTRL-ALT-F1 to login through command line and edit this file.(Tested on 10.04LTS Lucid Lynx)
Add the following to the end of /etc/gdm/PostLogin/Default (create this file file if it does not already exist):
Add the following to the end of /etc/kde3/kdm/Xsetup:
For the client file we must also edit the Xstartup script to kill our synergyc process running as root before the user Xsession scripts run. To do this add the following to the end of /etc/kde3/kdm/Xstartup and it should look like this:
Warning! Achtung! Synergy is not very secure at all! Consider – you are setting up something to allow an entirely different computer control the keyboard and mouse on your own computer! Don’t try and use this anywhere unsecure! There is a way of making it more secure by running it over OpenSSH, but that is currently beyond the scope of this article. More documentation is available on the Synergy website.
Quickstart Guide
There is a graphical tool available in the universe repositories for easily configuring and starting Synergy on both server and client computer calledQuickSynergy. If you don’t already know either the hostname of these computers, run the hostname command from a Terminal window.On the Client(s)
Follow these steps on the computer you would like to control with a remote keyboard and mouse.- Install QuickSynergy and open it (under Applications > Accessories)
- Under the ‘Use’ tab, type the IP address of the Host machine in the IP field, or use the hostname found above with .localadded to the end. Type in the hostname of the Client machine in the Screen field.
- Click Execute
On the Server
Follow these steps on the computer with the keyboard and mouse.- Install QuickSynergy and open it (under Applications > Accessories)
- Under the ‘Share’ tab enter the hostname or IP address of the Client machines in one of the directional boxes. The directional box you choose will determine which edge of the Host computer’s screen the mouse will “run off”.
- Click Execute
- Move the mouse to the edge of the Host screen — it should now appear on the client screen.
Manual Configuration
The following steps assume you are setting up synergy on a host computer named myserver and a client computer namedmyclient.On the Server
Synergy configuration can go in your home folder called .synergy.conf or in /etc/synergy.conf. It is up to you whether you would like the changes to be per-user or system-wide.Here is a sample configuration that will be the needs of 95% of users:
section: screens myserver: myclient: end section: links myserver: right = myclient myclient: left = myserver endmyserver is the hostname of the computer running synergys (providing the keyboard and mouse) myclient is the hostname of the computer running synergyc (using the keyboard and mouse provided by myserver) section: screens is where you set the host names of the computers going to be used. section: links is what side the mouse will leave the screen of one computer to reach the desktop of the other. myserver is set to the left of myclient, so when I drag the mouse off the right hand side ofmyserver‘s screen it appears on the left hand side myclient‘s screen. Use up/down instead of left/right to establish and over/under sort of relationship.
Running Synergy
From the server, run the command:synergysFrom the client, run the command:
synergyc <SERVER HOSTNAME>Replacing <SERVER HOSTNAME> with either the hostname (myclient) or IP address of myclient.
You should now be able to move your mouse pointer off the right edge of your server’s screen and see it show up at the left side of your client’s screen. See the steps in the next section to make synergy start automatically on the host and client computers.
If you have any problems at this point it is helpful to run synergys and synergyc in the foreground with the -f option. This allows you to see error/status information that synergy prints to the terminal.
Autostart Synergy after logging in (GNOME)
On the Server
Follow these steps to start synergys when you log into GNOME.Go to System Menu > Preferences > Startup Applications. Click “Add” and enter
synergys
If you want to use the configuration setup with QuickSynergy use this instead:
synergys -c ~/.quicksynergy/synergy.conf
Click OK and Close.
On the Client
Follow these steps to start synergyc when you log into GNOME.Go to System Menu > Preferences > Startup Applications. Click “Add” and enter
synergyc <SERVER HOSTNAME>
Replacing <SERVER HOSTNAME> with either the hostname or IP address of myserver.
Click OK and Close.
Autostart Synergy before logging in (GDM)
Note: Autostarting Synergy before logging in requires that your network connection be available at all times and not just after you log in. This is accomplished by enabling the network connection for all users. To do this, choose System->Preference->Network Connections. Choose the network name and select Edit. Select “Available to all users”, and then click “Apply”. This connection will now be available at all times, including at the GDM login screen.To make sure synergy is running at all times, the following has to happen: First, synergy is started when the GDM login screen starts. Then, synergy is killed and restarted when a user logs in. When the user logs out, synergy is killed and GDM starts it again. To edit system configuration files in the following sections open a text editor as the root user:
sudo gedit
On the Server
At the end of the file /etc/gdm/Init/Default, just before the line that says exit 0 add the following:/usr/bin/killall synergys while [ $(pgrep -x synergys) ]; do sleep 0.1; done /usr/bin/synergysAdd the following to the end of /etc/gdm/PostLogin/Default (create this file file if it does not already exist):
/usr/bin/killall synergys while [ $(pgrep -x synergys) ]; do sleep 0.1; doneIf you created the file, make sure it is executable with this command:
sudo chmod +x /etc/gdm/PostLogin/DefaultNow, create a session file /etc/X11/Xsession.d/85synergys with the following contents
/usr/bin/killall synergys while [ $(pgrep -x synergys) ]; do sleep 0.1; done /usr/bin/synergysLastly, we must make the file executable with this command:
sudo chmod +x /etc/X11/Xsession.d/85synergys
On the Client
At the end of /etc/gdm/Init/Default, just before the line that says exit 0 add the following:/usr/bin/killall synergyc while [ $(pgrep -x synergyc) ]; do sleep 0.1; done /usr/bin/synergyc <SERVER HOSTNAME>Be sure to replace <SERVER HOSTNAME> with the host name or IP address of the computer running synergys.
NOTE: If your system has been configured to login automatically, this step may cause ubuntu to hang right before going to the desktop. If this is the case, remove these lines from /etc/gdm/Init/Default and everything should work properly. If your system is hanging at this stage, you can hit CTRL-ALT-F1 to login through command line and edit this file.(Tested on 10.04LTS Lucid Lynx)
Add the following to the end of /etc/gdm/PostLogin/Default (create this file file if it does not already exist):
/usr/bin/killall synergyc while [ $(pgrep -x synergyc) ]; do sleep 0.1; doneIf you created the file, make sure it is executable with this command:
sudo chmod +x /etc/gdm/PostLogin/DefaultNow, create a session file /etc/X11/Xsession.d/85synergyc with the following contents
/usr/bin/killall synergyc while [ $(pgrep -x synergyc) ]; do sleep 0.1; done /usr/bin/synergyc <SERVER HOSTNAME>This will run synergyc when any user logs in. Be sure to replace <SERVER HOSTNAME> with the host name or IP address of the computer running synergys. Lastly, we must make the file executable with this command:
sudo chmod +x /etc/X11/Xsession.d/85synergyc
Autostart Synergy before logging in (KDM)
On the Client
Follow these steps to start the synergyc client when the KDM login screen launches.Add the following to the end of /etc/kde3/kdm/Xsetup:
/usr/bin/killall synergyc sleep 1 /usr/bin/synergyc <SERVER HOSTNAME>Be sure to replace <SERVER HOSTNAME> with the host name or IP address of the computer running synergys.
For the client file we must also edit the Xstartup script to kill our synergyc process running as root before the user Xsession scripts run. To do this add the following to the end of /etc/kde3/kdm/Xstartup and it should look like this:
# Xstartup - run as root before session starts PATH="$PATH:/usr/bin/X11" if [ -e /etc/nologin ]; then # always display the nologin message, if possible if [ -s /etc/nologin ] && which xmessage > /dev/null 2>&1; then xmessage -file /etc/nologin -geometry 640x480 fi if [ "$(id -u)" != "0" ] && \ ! grep -qs '^ignore-nologin' /etc/kde3/kdm/kdm.options; then exit 1 fi fi # synergyc process, running as root, ends here. This is the last script in the gdm login sequence before things start running as user. /usr/bin/killall synergyc sleep 1 if grep -qs '^use-sessreg' /etc/kde3/kdm/kdm.options && \ which sessreg > /dev/null 2>&1; then exec sessreg -a -l "$DISPLAY" -u /var/run/utmp \ -h "`echo $DISPLAY | cut -d: -f1`" "$USER" # NOTREACHED fi
Autostart Synergy before logging in (LightDM)
On the client
Add the following line at the end of /etc/lightdm/lightdm.conf:greeter-setup-script=/usr/bin/synergyc <SERVER HOSTNAME>Where <SERVER HOSTNAME> is the name/IP of the server you are connecting to.
On the server
Add the following line at the end of /etc/lightdm/lightdm.conf:greeter-setup-script=/usr/bin/synergys <CONFIG FILE>Where <CONFIG FILE> is the path to your config file for synergy (see above for typical locations).