My .vimrc File
Honestly I don't mind tabs in code. What I cant stand is when tabs mix in with spaces, but unless you're highlighting the '\t' character, you don't even know.
Obviously I cant stop others from using tabs... but the following settings help prevent ME from using them. (Along with a couple other goodies)
set shiftwidth=4 set tabstop=4 set showmatch set smarttab set expandtab
Local rpmbuild directory
Just so I don't forget this for the 26th time...
Typically, when you install a source RPM, it unpacks the source code in some location like "/usr/src/redhat". Unfortunately if you are not root, and do not have sudo permissions, you just don't have access to that directory. So instead, it would be helpful to have the ability to do any RPM building in a user-local directory... like "~/rpmbuild".
To do this, all you have to do is make the directory:
[jjinno@localhost ~]$ mkdir -p ~/rpmbuild
And then create yourself a file called "~/.rpmmacros" with the following contents:
%_topdir %(echo $HOME)/rpmbuild .%_smp_mflags -j3
And that's it!
Now when you run and RPM install of some source RPM, it will install the source code to "~/rpmbuild/SOURCES" and there will be an rpmbuild SPEC file located in "~/rpmbuild/SPECS". Simply change directory over to the SPEC file, and run your rpmbuild. (NOTE: just cause installing the source doesn't require root permissions does not necessarily mean that compiling the source will work without them)
Fedora 19 VNC setup
It has been a few releases of Fedora since I have installed a VNC server, and it appears that there is a great deal of confusion on the internet about how to do this... so I'm writing up what worked for me, so that some other poor soul can get this working. The end goal is to have a VNC server that: runs on Fedora 19, persists across reboots, and allows access to the XFCE4 Desktop Environment.
NOTE: I don't have Gnome/KDE even installed. This presents a challenge (not really) because the majority of the Fedora scripts are written to detect and work with Gnome/KDE and nothing else. In fact, if you dont have Gnome/KDE, you will usually end up failing back to TWM (yikes!).
First, we need to install the tigervnc-server:
[root@localhost ~]# yum install tigervnc-server Loaded plugins: langpacks, refresh-packagekit Resolving Dependencies --> Running transaction check ---> Package tigervnc-server.x86_64 0:1.3.0-7.fc19 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: tigervnc-server x86_64 1.3.0-7.fc19 updates 196 k Transaction Summary ================================================================================ Install 1 Package Total download size: 196 k Installed size: 481 k Is this ok [y/d/N]: y Downloading packages: tigervnc-server-1.3.0-7.fc19.x86_64.rpm | 196 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : tigervnc-server-1.3.0-7.fc19.x86_64 1/1 Verifying : tigervnc-server-1.3.0-7.fc19.x86_64 1/1 Installed: tigervnc-server.x86_64 0:1.3.0-7.fc19 Complete!
For the moment we are going to configure the VNC service to be running on a sub-port of the VNC service port (port 5900). In this example, we will be creating port-3 (offset from 5900). This means that port 5903 will need to be opened, but when we connect to the system from a remote host using the VNC protocol, we will only have to specify something like "10.16.2.22:3".
To create a configuration for port-offset 3, lets perform the following copy:
[root@localhost ~]# cp /lib/systemd/system/vncserver@.service \ /etc/systemd/system/vncserver@:3.service
Once you have a port-specific configuration file, open the file in your favorite editor, and you will see lines like the following:
ExecStart=/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i" PIDFile=/home/<USER>/.vnc/%H%i.pid
Replace the "<USER>" tags with the appropriate user. In the case of "root" (which is what I used) you have to make sure you change the PIDFile path to be inside "/root/.vnc". In the end, my configuration file looked like this:
[Unit] Description=Remote desktop service (VNC) After=syslog.target network.target [Service] Type=forking ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :' ExecStart=/sbin/runuser -l root -c "/usr/bin/vncserver %i" PIDFile=/root/.vnc/%H%i.pid ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :' [Install] WantedBy=multi-user.target
After configuring, we need to make sure the Fedora 19 firewall is prepared to allow VNC traffic in. To do this as a one-off for run-time only, you could use the following command:
[root@localhost ~]# firewall-cmd --zone=public --add-service vnc-server
However, if you want to have the firewall setting persist across reboots, you need to make that change permanent. To do so, just add the permanent option, like so:
[root@localhost ~]# firewall-cmd --permanent --zone=public --add-service vnc-server
If we were to start up our VNC server now, we would be able to log in (as I insinuated earlier), but would find ourselves dropped into a TWM desktop environment. I have nothing against TWM, but since the goal of this guide was to drop us into an XFCE4 desktop environment, TWM will simply not do.
Based upon soo many things out there on the interwebs, you may be tempted to edit some scripts, but I'm here to tell you that there is an easier way. The "/etc/sysconfig/desktop" file!
If your Fedora 19 system is like mine, then that file does not exist, and you need to create it. If that file does exist on your system, then there is one check you need to do: make sure "DESKTOP" is not specified in the file. I do that via a simple in-place sed-deletion:
[root@localhost ~]# sed -i '/DESKTOP/d' /etc/sysconfig/desktop
Then once we have eliminated any possibility that another desktop variable might be defined, we need to define another variable in this file. What you will see below is simply a way of defining the variable "PREFERRED" to be the full-path to the "startxfce4" program. Feel free to hard-code it instead of the lookup that I am doing:
[root@localhost ~]# echo 'PREFERRED="$(type -p startxfce4)"' \ >> /etc/sysconfig/desktop
Finally, we should setup a password for the VNC user to log in with. To do so, we first need to switch to that user, and then run "vncpasswd", like so:
[root@localhost ~]# su root [root@localhost ~]# vncpasswd Password: Verify:
That is 100% of the configuration necessary to start your VNC server. Now all we need to do is actually start it. (and since we will probably reboot at some point, lets make the service persistent too)
systemctl enable vncserver@:3.service systemctl start vncserver@:3.service
At this point, (assuming your network is working) you should be able to access this VNC server from another host. To do so, I simply open VNCViewer on my Windows box, specified "10.16.2.22:3", typed username/password... and VOILA!
I really hope this makes life easier for somebody. (Most likely me, the next time I try to remember what I did)
FC15: Synergy across multiple users
I was in the market to setup synergy on one of my desktop machines at work today. Synergy itself, no problem. However, it was running in the foreground of only one of my user accounts, which meant that logout/login would be impossible...
Looking for a way around this, I came across a guide which would get me about 99% of the way there. Here is the steps that I did, and what worked for me:
Server Side (Windows 7):
- First, I setup Synergy 1.4.10Beta on my Windows 7 laptop (named 'lappy'). I was setting this machine up as my Synergy server, so clicked the "server" bullet, then the "Configure server" button, and finally added my soon-to-be client (named 'bashful') to the setup.
- I opened up the Windows command prompt and ran "ipconfig /all" to identify my IP address for the client to connect to
Client Side (Fedora 15):
- In a terminal, with root permissions, I edited the "/etc/gdm/Init/Default", and added the line: "/usr/bin/synergyc --no-tray -n bashful {SERVER_IP}:24800" at the very end of the file, just before the "exit 0" line. (not exactly the same command as the above linked instructions)
- A reboot proved that I somehow didn't have my Ethernet interface enabled by default. Easily solved. (You can do this in the GUI by clicking on the network icon in the upper right and selecting "Network Settings". After the interface is turned on, you can click on "Options" and select "Connect Automatically")