19

PulseAudio is the standard audio server in desktop installations. However in a server installation audio services and thus PulseAudio are not provided.

How do I install and make use of PulseAudio in a headless server?

htorque
  • 63,950
  • 40
  • 194
  • 219
Takkat
  • 140,996
  • 54
  • 308
  • 426

1 Answers1

20

Install ALSA

$ sudo apt-get install libasound2 libasound2-plugins alsa-utils alsa-oss

Install PulseAudio:

$ sudo apt-get install pulseaudio pulseaudio-utils

Set Group Memberships for PA:

$ sudo usermod -aG pulse,pulse-access <username>

Run the PulseaudioServer:

$ pulseaudio -D

Following command tells us if a sink is recognized by PulseAudio:

$ pacmd list-sinks

Remember sinkname for output below.

This command will play a sound file to a given sink:

$ pacmd play-file <filename> <sinkname>

We may need to unmute audio devices:

  • for ALSA: use alsamixer
  • for Pulseaudio: use pacmd set-sink-mute n 0 where n is the sink index (likely 0)

For further CLI commands see also the Pulse Audio Wiki

To configure Pulseaudio Server to our needs we may need to edit /etc/pulse/default.pa and /etc/pulse/daemon.conf that come with self-explanatory. notes.

For testing the soundsystem see alsoSound Troubleshooting Guide

Takkat
  • 140,996
  • 54
  • 308
  • 426
  • Thanks! It works great! But in server installations the pulsaudio didn't started automatically. I also tried add "/usr/bin/pulseaudio -D" to /etc/rc.local, but it not helped. Do you know how to fix it? – Ivan Kolesnikov Aug 23 '17 at 18:55
  • 2
    Pulseaudio is designed to run in userspace after login. To run it as a service you need to run [pulseaudio system-wide](https://askubuntu.com/a/939338/3940) – Takkat Aug 23 '17 at 19:56
  • are you running in root? could you try pulseaudio --system? – Steve Jul 18 '18 at 14:50
  • Can you be more specific – user63726 May 07 '20 at 04:25