Installing Discord Canary on CentOS 7

General Linux

One of the latest in text and communication apps, Discord has quickly become among the most popular apps since its release in 2013. It provides a whole slew of features utilized by casual users and gamers, and even for office work. It has a thriving community, and it’s public API actively supports multiple languages for those who wish to extend it’s capabilities through web app integration and custom server bots. To top it off in April of 2016 Hammer and Chisel, the company behind the app, released what they are calling Discord Canary to the world of Linux. This was fantastic news as now Linux users can take advantage of all the app has to offer without being forced to use the web browser version. This does come with a catch, however.


At the time of writing Discord Canary is only actively supported on Ubuntu. The current download location is a staff GitHub repo linking to a rolling update server. According to the announcement Reddit post, however, it will also be available in the AUR for Arch users.

“Thanks for the kind words! In addition to the deb, we plan to get it in a ppa and AUR.”

So, what does this mean for users of other distros? I can tell you they aren’t out of luck. Nick Congleton over on Linux Config has outlined the basics of installing Discord on Ubuntu/Debian, Fedora, OpenSUSE, Arch, and Gentoo. You can find that post here. For RHEL/CentOS users, of which I am one, there are 3 paths that you can take to installing the Discord desktop application:

1. Use the .tar.gz package and do a very manual install
2. Attempt to use the Fedora copr repository
3. Repackage the .deb binary to .rpm like for OpenSUSE

The first one is a totally valid option and honestly the least work, which I did not know at the time when figuring this all out. It is the method I currently use, though. It will require you to add the extracted directory to your PATH to launch from the CLI and doesn’t integrate the same as installing a package natively does, for those who like having binaries in /usr/bin or /usr/local/bin without manual work. You will still have to install the missing dependencies. The second option seems viable as long as you access the copr repo from GitHub and know how to rebuild packages from a .spec file. I do not so I cannot attest to its actual success, and I also don’t believe you can use copr with Yum on RHEL/CentOS to my knowledge. I use the third option and can say that Discord has been running very smoothly on my end; I haven’t spotted any glaring issues yet. Enough rambling, let’s actually do some installing!

Getting Discord Canary

Despite seeming long, this guide is really 4 steps:

  1. Download Discord
  2. Convert from DEB to RPM
  3. Fix Errors
  4. Install

First things first, I want to say this will not be a complete guide to installing Discord. That would only be possible if it was the first application to be installed on a clean copy of your OS. This is not the case for me, I have a lot of apps installed related to film industry work so there may be package dependencies that I have already covered. The most likely culprits will be audio related packages and chromium libraries, so be on the lookout for any thrown errors there.

Alright, two packages are going to be needed to start. The first is obviously Discord Canary. The other package, Alien, is essential to this process as it will allow us to convert the Debian package into an RPM file. We may also need RPM Rebuild so be ready to install this as well. Navigate to a working directory of your choosing and run the following (if you already have Discord, you can download the update from the app itself):

$ wget -O discord-canary.deb https://discordapp.com/api/download/canary?platform=linux

I’m using the -O parameter to rename the downloaded file as wget will call the file canary?platform=linux instead of the actual deb file’s name.

Next up, we need get Alien to perform the conversion. As this is not in any of the official repos, even EPEL, you have 2 ways to install Alien. Either use the Nux Desktop repo, which is what I have done, or download and install the RPM from pkgs.org which coincidentally redirects you to Nux.

If using NUX:
$ yum install alien

If you don't want to install Nux:
$ wget http://li.nux.ro/download/nux/dextop/el7/x86_64//alien-8.90-3.el7.nux.noarch.rpm
$ sudo yum install ./alien-8.90-3.el7.nux.noarch.rpm

Creating the RPM Package

As a preface, I prefer to use yum to install any RPM’s unless warranted otherwise, as it’ll check for dependencies and download them to prevent software breaks. Yes this adds more to the stack, but I prefer to be safer than sorry.

Now that we have Alien, we need to use it to convert the DEB file to and RPM.

$ sudo alien -r -c ./discord-canary-version.deb

This command will convert the DEB to RPM with -r and will include scripts with -c . You may want to include the -v flag if you wish to see what the app is doing. You may forego the use of sudo but I’m a paranoid person and prefer to keep permissions intact. During Alien’s processing a folder will appear where it unpacks and then repacks the DEB file into an RPM package. You should now have that package.

Give the package a go with installing, either using yum localinstall package or rpm -ivh package (-Uvh if updating). You will need to use sudo for this. I would recommend using yum first as it will allow you to install any dependencies with the application.

Notice: As of around Fall 2017 Discord now requires a version of libcxx that is not developed and distributed in the main CentOS and associated repositories. Users will either have to build libcxx and libcxxabi from source or find a suitable distributed package. Version 5.0.0 is the minimum version known to work.

 

If you’re install goes anything like mine there’s a good chance you’ll hit a bunch of errors. Using rpm I can get errors with conflicting versions, whereas with yum it’ll tell me if I’m upgrading a previous package and list any errors. At the time of writing my errors looks like this:

Transaction check error:
file / from install of discord-canary-0.0.16-2.x86_64 conflicts with file from package filesystem-3.2-21.el7.x86_64
file /usr/bin from install of discord-canary-0.0.16-2.x86_64 conflicts with file from package filesystem-3.2-21.el7.x86_64

If you didn’t get any errors like this, congrats! You should be totally okay to start using Discord on your machine. Otherwise buckle down as we have some editing to do.

Fixing Errors

Note the locations that are spouting the errors. In my case this is / and /usr/bin of the RPM package. There is an package in EPEL called rpmrebuild which will allow us to edit the RPM package and remove these errors. Install it then run this command:

$ sudo rpmrebuild -pe discord-canary-version.rpm

Vim will launch and you’ll want to scroll down the the section starting with %files. Find and remove the lines that contain the error locations. You can do this by either placing the cursor on the offending line and pressing d twice, or press i and manually delete the lines. If you make a mistake, press esc, and use u to undo. To save and exit, make sure you exit insert mode by pressing esc and type :wq followed by enter or return. You’ll be prompted with Do you want to continue ? (y/N) ; type y and enter to accept. You may receive a few symlink errors, but it’s safe to ignore them.

After rpmrebuild does its thing, note the result line in the output. In my case:

result: /root/rpmbuild/RPMS/x86_64/discord-canary-0.0.16-2.x86_64.rpm

Run either yum localinstall or rpm -ivh (or -Uvh if updating) with sudo to install the package. If you didn’t run Alien and RPMRebuild with elevated privileges, it might not be in your /root directory.

$ sudo yum localinstall /root/rpmbuild/RPMS/x86_64/discord-canary-0.0.16-2.x86_64.rpm

If this installed without errors, you should now see a Discord-Canary .desktop reference in your Desktop Environment’s start menu, as well as be able to launch Discord from the command line with discord-canary. If you have any issues or if this works for you let me know in the comments below!

Known Package Requirements

I highly recommend running Discord from the command line the first few times you launch it, as there are some packages and shared objects that don’t show up as dependencies during install. These will be listed in the startup output and you’ll have to install them manually

chromium-libs from Chromium Browser in EPEL

libc++.so.1 from libcxx in EPEL

libatomic from Base

For Reference

Some links that helped me iron out the kinks:

https://linuxconfig.org/how-to-install-discord-on-linux

http://stackoverflow.com/questions/27172142/conflicts-with-file-from-package-filesystem-3-2

https://github.com/crmarsh/discord-linux-bugs

https://github.com/stellarhopper/discord-rpm-packaging

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s