Linkage between chromosomal loci and the Hardy-Weinberg principle
Linkage is a physical reality

Linkage refers to the physical presence of several loci on the same chromosome. Two loci that are said to be in close linkage mean that they are locataed relatively close to each other on the same chromosome.

Linkage disequilibrium is a statistical reality

If two alleles at two different loci are found on the same haplotype than expected by chance (that is more often than the product of the respective frequencies), then there is an statistical association between these two loci. We refer to this statistical association as linkage disequilibrium (abbreviated LD). If there is absence of statistical association, then the two loci are independent and we talk about linkage equilibrium.

Let's consider two bi-allelic loci. We will call the two loci A and B and the two alleles A0, A1 and B0, B1 at loci A and B, respectively. Let $p_{AB}$ be the frequency of the haplotypes that contains both A1 and B1. Let $p_A$ and $p_B$ be the frequencies of the alleles A1 and B1, respectively. Then LD between the loci A and B (called $D_{AB}$) is defined as

$$D_{AB} = p_{AB} - p_Ap_B$$

There are other related mathematical definitions of LD than $D_{AB}$, such as $D'_{AB} = \frac{D_{AB}}{D_{max,AB}}$ and the correlation of coefficient among the two loci $r_{AB}$.

Linkage disequilibrium and Hardy-Weinberg equilibrium

You will note that, knowing whether or not each of the two loci are in H-W equilibrium (or respecting the assumptions of H-W equilibrium; see this post) tells you nothing about LD among these two loci. For example, two loci can both be at H-W equilibrium but be in LD (or in linkage equilibrium). Similarly, two loci can both be at H-W non-equilibrium but be in LD (or in linkage equilibrium). 

Linkage and linkage disequilibrium

Various things can affect LD. In theory, there is no need for linkage to have linkage disequilibrium. A strong epistatic interaction for early life survival between two loci (whether or not they are in the same chromosome) can eventually cause  LD. However, most of the cases of known LD probably concern pairs of loci found in tight linkage. There is a diversity of processes that lead to LD and reviewing them would be outside the scope of this answer.