1
00:00:00,020 --> 00:00:01,740
In this lesson, we're going to discuss

2
00:00:01,740 --> 00:00:04,560
the best ways to troubleshoot software dependency issues

3
00:00:04,560 --> 00:00:07,590
that you might encounter as a Linux system administrator.

4
00:00:07,590 --> 00:00:09,630
Your troubleshooting efforts will first start out

5
00:00:09,630 --> 00:00:12,300
by identifying the method that you are attempting to use

6
00:00:12,300 --> 00:00:14,610
when installing the software in the first place,

7
00:00:14,610 --> 00:00:16,740
because you're going to look at things differently

8
00:00:16,740 --> 00:00:18,990
depending on whether you're using a package manager

9
00:00:18,990 --> 00:00:21,660
like YUM, DNF, or APT,

10
00:00:21,660 --> 00:00:24,720
or if you're actually installing the software manually

11
00:00:24,720 --> 00:00:26,700
by compiling it yourself.

12
00:00:26,700 --> 00:00:28,710
Now, if you're using a package manager,

13
00:00:28,710 --> 00:00:30,960
you should first check the configuration files

14
00:00:30,960 --> 00:00:33,240
for your specific package management system

15
00:00:33,240 --> 00:00:34,620
to ensure that it's set up to query

16
00:00:34,620 --> 00:00:36,000
in the right repositories

17
00:00:36,000 --> 00:00:37,830
that are containing the software packages

18
00:00:37,830 --> 00:00:40,590
and the required dependencies that you're trying to install.

19
00:00:40,590 --> 00:00:43,200
For example, if you've set up your package manager

20
00:00:43,200 --> 00:00:45,720
to use the local repository on your Linux server

21
00:00:45,720 --> 00:00:48,150
but you haven't copied over all those packages

22
00:00:48,150 --> 00:00:50,460
and dependencies into that repository,

23
00:00:50,460 --> 00:00:51,480
well, guess what?

24
00:00:51,480 --> 00:00:54,060
Your package manager is not going to be able to resolve

25
00:00:54,060 --> 00:00:56,730
all the package dependencies for you automatically

26
00:00:56,730 --> 00:00:58,980
'cause it can't find those files.

27
00:00:58,980 --> 00:01:01,470
If you're using APT as your package manager,

28
00:01:01,470 --> 00:01:06,470
make sure you look at the /etc/apt/sources.list.d directory,

29
00:01:08,100 --> 00:01:13,100
and check your /etc/apt.conf configuration file.

30
00:01:13,800 --> 00:01:15,990
If you're using YUM as your package manager,

31
00:01:15,990 --> 00:01:20,820
make sure you look at the /etc/yum.repo.d directory,

32
00:01:20,820 --> 00:01:25,820
and the /etc/yum.conf configuration file.

33
00:01:25,860 --> 00:01:27,480
If you're using DNF,

34
00:01:27,480 --> 00:01:30,030
make sure you check the DNF configuration file

35
00:01:30,030 --> 00:01:35,030
at /etc/dnf/dnf.conf.

36
00:01:35,430 --> 00:01:39,300
Remember, package managers like APT, YUM, and DNF

37
00:01:39,300 --> 00:01:42,060
use information from inside the packages themselves

38
00:01:42,060 --> 00:01:43,500
to discover what dependencies

39
00:01:43,500 --> 00:01:46,200
each software requires for its installation.

40
00:01:46,200 --> 00:01:47,730
When you're installing the package,

41
00:01:47,730 --> 00:01:50,100
the package manager can automatically locate,

42
00:01:50,100 --> 00:01:53,310
download, and install the right dependency packages for you

43
00:01:53,310 --> 00:01:55,320
if you issue that option when you're running

44
00:01:55,320 --> 00:01:57,390
the package manager's installation command

45
00:01:57,390 --> 00:01:59,430
from the command line environment.

46
00:01:59,430 --> 00:02:01,410
Now, if a piece of software doesn't appear

47
00:02:01,410 --> 00:02:03,900
to be functioning properly after you install it,

48
00:02:03,900 --> 00:02:05,520
you can verify that the software

49
00:02:05,520 --> 00:02:07,483
and its dependencies were properly installed

50
00:02:07,483 --> 00:02:09,960
by issuing the verify command.

51
00:02:09,960 --> 00:02:12,960
For example, with the Red Hat package manager,

52
00:02:12,960 --> 00:02:16,950
you can enter rpm -V and the package name

53
00:02:16,950 --> 00:02:18,870
in order to verify that all the components

54
00:02:18,870 --> 00:02:20,910
from the package and its dependencies

55
00:02:20,910 --> 00:02:22,770
were properly installed.

56
00:02:22,770 --> 00:02:25,440
If you want to identify what dependencies are required

57
00:02:25,440 --> 00:02:27,060
before you install something,

58
00:02:27,060 --> 00:02:28,770
you can do that with RPM

59
00:02:28,770 --> 00:02:33,330
by typing rpm -qR and the package name

60
00:02:33,330 --> 00:02:35,100
using the Red Hat package manager,

61
00:02:35,100 --> 00:02:38,010
or yum deplist package name,

62
00:02:38,010 --> 00:02:40,470
if you're using the YUM package manager.

63
00:02:40,470 --> 00:02:42,810
If you're using a Debian based version of Linux,

64
00:02:42,810 --> 00:02:45,990
you can instead use apt-cache depends

65
00:02:45,990 --> 00:02:49,140
and the package name to list out the packages' dependencies

66
00:02:49,140 --> 00:02:51,690
prior to trying to install that package.

67
00:02:51,690 --> 00:02:54,570
Now, if your system cannot find the right dependency,

68
00:02:54,570 --> 00:02:56,760
this is often because there's a different version

69
00:02:56,760 --> 00:02:59,130
that's being requested than what actually exists

70
00:02:59,130 --> 00:03:00,930
inside your repository.

71
00:03:00,930 --> 00:03:02,070
If this is the case,

72
00:03:02,070 --> 00:03:05,070
try running the APT update command first to ensure

73
00:03:05,070 --> 00:03:06,600
that your package manager has a list

74
00:03:06,600 --> 00:03:08,040
of the most recent versions

75
00:03:08,040 --> 00:03:11,010
of the dependency packages that you're trying to install.

76
00:03:11,010 --> 00:03:13,680
Also, if you can't download a dependency,

77
00:03:13,680 --> 00:03:16,800
sometimes it's as simple as a broken network connection.

78
00:03:16,800 --> 00:03:18,780
So I recommend that you try pinging

79
00:03:18,780 --> 00:03:20,430
the repository server's host name

80
00:03:20,430 --> 00:03:23,790
or IP address to validate that your system has a good

81
00:03:23,790 --> 00:03:25,770
and solid connection all the way over

82
00:03:25,770 --> 00:03:28,320
to the repost server that you're trying to use.

83
00:03:28,320 --> 00:03:30,420
Now, if you're trying to manually compile a piece

84
00:03:30,420 --> 00:03:32,400
of software and you start having issues,

85
00:03:32,400 --> 00:03:35,460
it could be an issue with the compiling software itself.

86
00:03:35,460 --> 00:03:37,890
In these cases you should check the documentation

87
00:03:37,890 --> 00:03:39,090
for your compiler.

88
00:03:39,090 --> 00:03:41,220
Normally this is going to be GCC

89
00:03:41,220 --> 00:03:42,840
if you're using a Linux system.

90
00:03:42,840 --> 00:03:45,150
But you can also use different compilers

91
00:03:45,150 --> 00:03:47,850
on your Linux system if you install those.

92
00:03:47,850 --> 00:03:50,310
To find out what libraries and dependencies are required

93
00:03:50,310 --> 00:03:52,140
for a particular piece of software,

94
00:03:52,140 --> 00:03:54,030
you're going to run the LDD command

95
00:03:54,030 --> 00:03:55,560
against that binary.

96
00:03:55,560 --> 00:03:58,380
To use this, simply enter ldd option

97
00:03:58,380 --> 00:04:00,877
and the program binary at the command prompt.

98
00:04:00,877 --> 00:04:03,060
Once you do that, you're going to get back a list

99
00:04:03,060 --> 00:04:05,280
of library files and their versions.

100
00:04:05,280 --> 00:04:08,280
Now you need to verify the library file versions

101
00:04:08,280 --> 00:04:10,680
for those files and versions are actually available

102
00:04:10,680 --> 00:04:11,790
on your system.

103
00:04:11,790 --> 00:04:12,810
And once you do that,

104
00:04:12,810 --> 00:04:15,180
you should be able to compile that program.

105
00:04:15,180 --> 00:04:17,370
If you're having issues compiling the software,

106
00:04:17,370 --> 00:04:19,680
it's also possible that you might need to run

107
00:04:19,680 --> 00:04:22,170
the make install command using sudo

108
00:04:22,170 --> 00:04:23,880
to assume root privileges.

109
00:04:23,880 --> 00:04:25,620
Sometimes in Linux, you're going to find

110
00:04:25,620 --> 00:04:27,180
that you need to elevate your permissions

111
00:04:27,180 --> 00:04:29,460
in order to compile certain programs or code

112
00:04:29,460 --> 00:04:32,010
depending on what binaries are being called.

113
00:04:32,010 --> 00:04:33,570
Finally, let's take a moment

114
00:04:33,570 --> 00:04:36,480
and talk about updating and upgrading software.

115
00:04:36,480 --> 00:04:38,490
This is often done when a security bug needs to

116
00:04:38,490 --> 00:04:39,990
be fixed or patched.

117
00:04:39,990 --> 00:04:40,980
And when you do this,

118
00:04:40,980 --> 00:04:43,470
you always need to have a back out plan.

119
00:04:43,470 --> 00:04:45,930
This means you know upfront what you're going to do

120
00:04:45,930 --> 00:04:47,490
if something goes wrong.

121
00:04:47,490 --> 00:04:49,620
For example, if you're upgrading the software

122
00:04:49,620 --> 00:04:52,170
from version 1.1 to version 2.0,

123
00:04:52,170 --> 00:04:53,880
this could cause massive issues

124
00:04:53,880 --> 00:04:55,830
and cause a big disruption to your business

125
00:04:55,830 --> 00:04:57,360
if version two breaks some kind

126
00:04:57,360 --> 00:05:00,660
of backward compatibility with other things on your system.

127
00:05:00,660 --> 00:05:03,270
Or let's say you're upgrading your version of PHP,

128
00:05:03,270 --> 00:05:05,430
but you don't upgrade your version of Apache.

129
00:05:05,430 --> 00:05:06,930
This can cause big issues

130
00:05:06,930 --> 00:05:08,940
and compatibility for your website

131
00:05:08,940 --> 00:05:11,760
if it's being run on that particular Linux server.

132
00:05:11,760 --> 00:05:13,320
For these reasons, it's important

133
00:05:13,320 --> 00:05:16,020
that you always have a solid backup before you get started,

134
00:05:16,020 --> 00:05:18,840
as well as a good back out plan and restoration plan

135
00:05:18,840 --> 00:05:20,613
for how you're going to remove the problem software

136
00:05:20,613 --> 00:05:23,100
and get back to a known good configuration

137
00:05:23,100 --> 00:05:24,810
if something goes wrong.

138
00:05:24,810 --> 00:05:27,660
Remember, it's always a good idea to test upgrades

139
00:05:27,660 --> 00:05:29,640
and patches in a development environment

140
00:05:29,640 --> 00:05:31,470
or a staging environment first.

141
00:05:31,470 --> 00:05:34,530
And then once you've figured out everything's working okay,

142
00:05:34,530 --> 00:05:36,060
you can then apply those upgrades

143
00:05:36,060 --> 00:05:37,650
to your production servers.

144
00:05:37,650 --> 00:05:39,210
This is going to minimize your chances

145
00:05:39,210 --> 00:05:41,040
of breaking things that would directly

146
00:05:41,040 --> 00:05:44,370
affect your business operations and cause outages.

147
00:05:44,370 --> 00:05:46,020
Now, if things go wrong when you're trying

148
00:05:46,020 --> 00:05:48,390
to update or install a piece of software,

149
00:05:48,390 --> 00:05:50,340
you should go check the installation logs

150
00:05:50,340 --> 00:05:52,050
to determine exactly what happened

151
00:05:52,050 --> 00:05:54,630
and how you can best fix and overcome those issues.

152
00:05:54,630 --> 00:05:55,950
Because most of the time,

153
00:05:55,950 --> 00:05:58,830
the installation logs will tell you exactly what went wrong,

154
00:05:58,830 --> 00:06:02,163
such as a missing dependency or incorrect file permissions.

