How to install Mate Compiz and Docky on Centos 7
Posted: 2014/08/04 15:54:14
Mate 1.8 from Epel, Compiz from nux-dextop (with some elements still from F19) and Docky from Fedora 19 repos, seem to behave nicely on CentOS 7. I therefore wrote a script that will automate the installation of those packages. The script can be applied to minimal CentOS7 system and it will install X-Windows and then the Mate Desktop, or to an existing desktop system and it will then add the Mate Desktop and optionally remove the "Gnome 3 shell" and "Gnome Classic" desktops. Installation of compiz and docky is optional. Since in an existing desktop system the script may interfere with the existing X session and with the Display Manager, it should run at run level 3 (multiuser level).
Here is what the script does:
1. Get information from the user what he/she wants to do.
2. Update the system and then install yum-plugin-priorities.
3. Enable epel, nux-dextop, elrepo and rpmforge external repositories and set priorities in such a way that CentOS packages will not be overwritten.
4. If needed, install the "X Windows System" packages group Install the "Mate Desktop" group from Epel
6. Install caja .desktop file in /etc/xdg/autostart/ to ensure that icons on the desktop are visible.
7. Set the default runlevel to "graphical user" (level 5)
8. Optionally, remove gnome-session, gnome-classic-sesion and related packages.
9. If 8 was performed or if so choosen by the user, set lightdm as the default window manager.
10. Optionally, install Fedora19 repos, install compiz and docky
11. Disable the Fedora19 repositories.
I sucesfully checked the script both on a VirtualBox guest machine an on a real hardware. Saying that, I am of course nor responsible for any damage this script may cause to you.
Note
So, here it is:
---------------------------------------------------------------------------------------------------------------------------------------------
Here is what the script does:
1. Get information from the user what he/she wants to do.
2. Update the system and then install yum-plugin-priorities.
3. Enable epel, nux-dextop, elrepo and rpmforge external repositories and set priorities in such a way that CentOS packages will not be overwritten.
4. If needed, install the "X Windows System" packages group Install the "Mate Desktop" group from Epel
6. Install caja .desktop file in /etc/xdg/autostart/ to ensure that icons on the desktop are visible.
7. Set the default runlevel to "graphical user" (level 5)
8. Optionally, remove gnome-session, gnome-classic-sesion and related packages.
9. If 8 was performed or if so choosen by the user, set lightdm as the default window manager.
10. Optionally, install Fedora19 repos, install compiz and docky
11. Disable the Fedora19 repositories.
I sucesfully checked the script both on a VirtualBox guest machine an on a real hardware. Saying that, I am of course nor responsible for any damage this script may cause to you.
Note
So, here it is:
---------------------------------------------------------------------------------------------------------------------------------------------
Code: Select all
#!/bin/bash
#
### This script will install Mate desktop from EPEL repository
# on a CentOS 7 system.
# Optionaly, the "Gnome3 shell", "Gnome Classic desktop"
# and gdm will be removed. In this case, the lightdm display
# manager will be set as the default window manager.
#
# Compiz and docky from Fedora19, seem to work nicely with CentOS7,
# therefore, as another option, the script will install them
# from Fedora19 standard repositories.
#
# Copyright 2014 by Yoram Gnat <yoram.gnat@gmail.com>
# Published under GPL v2 License
#
# Note: Since this script may change the display session
# ==== and display manager it should run at runlevel 3 (multiuser)
# and not runlevel 5 (graphical user)
#
#================================================================
### Be sure we are at runlevel 3
runlevel | grep 3 > /dev/null
if [ "$?" != "0" ]; then
echo "This script should run at level 3 (multiuser level)."
echo "As root, type the command 'init 3' in a shell"
echo "then, login as root and run this script again"
exit 1
fi
#================================================================
InstallX="false"
RemoveG3="false"
LightdmIsDefault="false"
InstallCompiz="false"
echo
echo "Mate Desktop will be installed on your system."
echo
### if X server is not installed we have the minimal installation and the
# questions are irrelevant.
rpm -q xorg-x11-server-Xorg > /dev/null
if [ "$?" != "0" ]; then
InstallX="true"
LightdmIsDefault="true"
### else let's find what we should do
else
echo "Do you want to remove GNOME3 and Gnome Classic desktops "
echo -n "after installing Mate ? (y/n)"
read A
if [ "$A" = "y" ]; then
RemoveG3="true"
LightdmIsDefault="true"
else
echo -n "Do you want to make lightdm the default window manager ? (y/n)"
read A
if [ "$A" = "y" ]; then
LightdmIsDefault="true"
fi
fi
fi
### What about compiz and docky ?
echo -n "Do you want to install Compiz (y/n) and docky from Fedora19 ? (y/n)"
read A
if [ "$A" = "y" ]; then
InstallCompiz="true"
fi
HERE=`pwd`
#============================ Here we start =============================
#
### Update the system
echo
echo "Updating System"
echo
yum -y update
#=============================================================================
# We need yum priorities to ensure base CentOS packages are not overwritten.
yum -y install yum-plugin-priorities
#==============================================================================
#
### Enable extra repos (epel, nux-dextop, elrepo and rpmforge)for CentOS 7
# EPEL
if [ ! -f /usr/yum.repos.d/epel.repo ]; then
rpm -Uvh http://dl.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm
fi
# nux-dextop
if [ ! -f /usr/yum.repos.d/nux-dextop.repo ]; then
rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-3.el7.nux.noarch.rpm
fi
# ELREPO
if [ ! -f /usr/yum.repos.d/elrepo.repo ]; then
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
fi
# RPMFORGE
if [ ! -f /usr/yum.repos.d/rpmforge.repo ]; then
rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
fi
### Set repo priorities
echo
echo "Set yum priorities to ensure that packages from official CentOS"
echo "repositories are not overwritten."
echo
echo "CentOS-Base repos, priority=1"
cp /etc/yum.repos.d/CentOS-Base.repo /tmp/CentOS-Base.repo
sed \
-e ' s/\[base\]/\[base\]\npriority=1/g' \
-e ' s/\[updates\]/\[updates\]\npriority=1/g' \
-e ' s/\[extras\]/\[extras\]\npriority=1/g' \
-e ' s/\[centosplus\]/\[centosplus\]\npriority=1/g' \
-e ' s/\[contrib\]/\[contrib\]\npriority=2/g' \
-e ' s/enabled=0/enabled=1/g' /tmp/CentOS-Base.repo > /etc/yum.repos.d/CentOS-Base.repo
echo "epel repo, priority=10"
cp /etc/yum.repos.d/epel.repo /tmp/epel.repo
sed -e 's/\[epel\]/\[epel\]\npriority=10/g' /tmp/epel.repo > /etc/yum.repos.d/epel.repo
echo "nux-dextop repo, priority=11"
cp /etc/yum.repos.d/nux-dextop.repo /tmp/nux-dextop.repo
sed -e 's/\[nux-dextop\]/\[nux-dextop\]\npriority=11/g' /tmp/nux-dextop.repo > /etc/yum.repos.d/nux-dextop.repo
echo "elrepo repo, priority=12"
echo
cp /etc/yum.repos.d/elrepo.repo /tmp/elrepo.repo
sed -e 's/\[elrepo\]/\[elrepo\]\npriority=12/g' /tmp/elrepo.repo > /etc/yum.repos.d/elrepo.repo
echo "rpmforge repo, priority=13"
cp /etc/yum.repos.d/rpmforge.repo /tmp/rpmforge.repo
sed -e 's/\[rpmforge\]/\[rpmforge\]\npriority=13/g' /tmp/rpmforge.repo > /etc/yum.repos.d/rpmforge.repo
echo
#==========================================================================
# If we start with minimal system, we should install X
# Since we do not want proprietary drivers at this stage, let's disable elrepo
# Such drivers, eg. nvidia, can be installed later.
if [ $InstallX = "true" ]; then
yum -y --disablerepo=elrepo groupinstall "X Window System"
fi
#==========================================================================
#
### Mate Desktop
#
yum -y groupinstall "MATE Desktop"
### Be sure we start at what was once called run level 5 (graphical user).
systemctl set-default graphical.target
### Be sure caja is autostarting so that desktop icons will be visible
#
cat > /etc/xdg/autostart/caja-manage-desktop.desktop << EOF
[Desktop Entry]
Name=caja-manage-desktop.desktop
GenericName=File Manager
Exec=caja --no-default-window
Icon=system-file-manager
Terminal=false
Type=Application
StartupNotify=true
NoDisplay=true
OnlyShowIn=MATE;
X-MATE-Bugzilla-Bugzilla=MATE
X-MATE-Bugzilla-Product=caja
X-MATE-Bugzilla-Component=general
X-MATE-Bugzilla-Version=1.8.0
X-MATE-Autostart-Phase=Desktop
X-MATE-Autostart-Notify=true
X-MATE-AutoRestart=true
X-MATE-Provides=filemanager
X-Desktop-File-Install-Version=0.21
Name[en_US]=caja-manage-desktop.desktop
EOF
#==========================================================================
#
if [ "$RemoveG3" = "true" ]; then
### Remove gdm, Gnome3 shell and Gnome Classic
yum -y remove \
gdm \
gnome-backgrounds gnome-boxes gnome-calculator \
gnome-classic-session gnome-color-manager \
gnome-contacts gnome-dictionary gnome-documents \
gnome-font-viewer gnome-getting-started-docs \
gnome-initial-setup gnome-packagekit gnome-shell \
gnome-shell-extension* gnome-system-log gnome-terminal \
gnome-tweak-tool gnome-video-effects gnome-weather \
gnome-session nautilus*
# just to be sure, remove definitions of old sessions if still there
rm -f /usr/share/xsessions/*gnome*.desktop
rm -f /usr/share/xsessions/*custom*.desktop
fi
#===============================================================================
#
if [ "$LightdmIsDefault" = "true" ]; then
### make lightdm the default display manager
ln -sf /usr/lib/systemd/system/lightdm.service /etc/systemd/system/display-manager.service
fi
#===================================================================================
# Be sure some stuff we need is installed.
# We need gcc and kernel-devel if we are a VirtualBox guest and want the
# VirtualBox additions installed.
# We need wget later in this script and if docky is installed, xdotool may be helpful.
# Since the xdotool from EPEL won't install we will install the one from nux-dextop.
# Luckily epel is not needed for the other stuff.
yum -y --disablerepo=epel install gcc kernel-devel kernel-headers wget xdotool yumex
#====================================================================================
#
### Compiz
#
# Let's have compiz. The Fedora19 version works prety well on CentOS7.
# The only installation problem is that mate-compiz depends on libmatewnck
# that is obsoleted by mate-desktop in 1.8. Since the two packages
# do not share the same files, there is no real problem in forcing the
# installation of both. So, we download the libmatewnck package and install it with
# "rpm --nodeps -ivh ...", then activate the Fedora19 yum repos and install the rest
# with yum. Since we already have the F19 repos, let's install docky as well.
# The Fedora19 repos are at very low priority (50) so F19 packages will not overide
# the CentOS7 stuff.
if [ "$InstallCompiz" = "true" ]; then
# get the Fedora19 repositories
cat > /etc/yum.repos.d/fedora19.repo << EOF
[fedora19]
priority=50
name=Fedora 19 - x86_64
failovermethod=priority
baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/19/Everything/x86_64/os/
enabled=0
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-19-x86_64
[fedora19-updates]
priority=50
name=Fedora 19 - - Updates
failovermethod=priority
baseurl=http://download.fedoraproject.org/pub/fedora/linux/updates/19/x86_64/
enabled=0
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-19-x86_64
EOF
cd /tmp
# get the GPG key
wget https://fedoraproject.org/static/FB4B18E6.txt
mv -f FB4B18E6.txt /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-19-x86_64
#!!! Not needed anymore thanks to nux-dextop repo. Most of compiz, adopted to Mate 1.8
# on CentOS 7 is already there
### install libmatewnck
#wget http://download.fedoraproject.org/pub/fedora/linux/updates/19/x86_64/libmatewnck-1.6.1-1.fc19.x86_64.rpm
#rpm --nodeps -ivh libmatewnck-1.6.1-1.fc19.x86_64.rpm
#rm -f libmatewnck-1.6.1-1.fc19.x86_64.rpm
cd $HERE
#### finally install compiz and docky
yum -y install --enablerepo=fedora19 --enablerepo=fedora19-updates compiz compiz-mate compiz-manager \
fusion-icon compiz-plugins-main compiz-plugins-extra docky
fi
#==========================================================================
#
echo
echo "Reboot the system now."
echo
if [ "$InstallCompiz" = "true" ]; then
echo "To start using compiz, run 'compiz-mate-emerald' or 'compiz-mate-gtk'."
echo "To make it permanent run for example:"
echo "gsettings set org.mate.session.required-components windowmanager compiz-mate-gtk"
echo
echo "You can configure compiz plugins using 'ccsm' - the compiz configuration manager."
echo
fi
echo
echo "Have fun."
echo
exit 0