# [Solana]Anchor problem with openssl in CentOS 9

By [Kevin](https://paragraph.com/@kevin-45) · 2022-12-05

---

What is the problem
-------------------

When to execute `anchor test`, the terminal would be shown somethings like `libssl.so.1.1: cannot open shared object file: No such file or directory`, and the fact is your openssl has already been installed, so why is that?

* * *

Why dose the issue come
-----------------------

Before we start, you can have a check with `openssl version` in your terminal.

Yes, as you can see, in CentOS 9, the default openssl version is 3.0+, this is the reason why you got the error with `libssl.so.1.1`, because you really do not have openssl 1.1.0+, but 3.0+ instead, which is not suitable.

* * *

How to fix it
-------------

We quickly start to fix it by installing openssl 1.1.0+, and a good news is you don’t really have to uninstall the 3.0+ version, according to [here](https://unix.stackexchange.com/a/723039). So let’s just simply install it by the source package following the steps.

### Firstly, downloading the source code of openssl 1.1.0+

Downloading source code by using [this official link](https://www.openssl.org/source/), as I cannot know what time you see this article and whether there is a update for openssl 1.1.0+, so just scrolling down and find the place as the picture shows bellow, then right click the file name and copy address link.

![openssl 1.1.0+](https://storage.googleapis.com/papyrus_images/7c6d9a16ca314f3d00998a950a53239d6c46c725f5922ae83c2da2c6832c56cd.png)

openssl 1.1.0+

> Please make sure you copy the link of openssl-1.1.xxxx.tar.gz, not the other versions.

Then go back to your terminal, using `wget [paste the copied link here withouth square brackets]`, for me is like bellow.

![wget openssl source package](https://storage.googleapis.com/papyrus_images/7901654a8b273453029b56c1ca6a683d2529c9717bdf6f5fa5d6663b81871939.png)

wget openssl source package

### Secondly, installing openssl from this source package

> Installing tools and dependencies before for after usage.

`sudo dnf update -y #this will make sure your local software list is updated to latest version.`

`sudo dnf group install ‘Development Tools‘ -y #install development tools which includes compile tools.`

`sudo dnf install perl-core zlib-devel -y #and these two things too.`

> OK, now you have the compile tools for OpenSSL, let’s go and install it!

`tar -xzvf opensslxxxx.tar.gz #the file’s name is as what you have downloaded from official website.`

`cd opensslxxxx #go into the folder that extracted right above, the name should be your openssl source file erased .tar.gz.`

`./config --prefix=/opt/openssl --openssldir=/usr/local/ssl shared zlib`

`sudo make && make install #just wait, this will be finished soon.(or not lol)`

### Final step, \[must do\], configure all things

`sudo mv /bin/openssl /bin/openssl.backup #we’ll use new 1.1.0+ one to instead old 3.0+ one, so just move it as a backup.`

`sudo vi /etc/profile.d/openssl.sh #openning this file for export path of our new openssl in $PATH.`

    #paste this all into the opening edit window.
    OPENSSL_PATH=”/usr/local/ssl/bin”
    export OPENSSL_PATH
    PATH=$PATH:$OPENSSL_PATH
    export PATH
    

`:wq #write and quit the file.`

`sudo chmod +x /etc/profile.d/openssl.sh #make this file can be executed.`

`source /etc/profile.d/openssl.sh #export our new openssl execute path into $PATH.`

`echo $PATH #if you like, you can have a check with this, should be at the end of the string.`

`sudo vi /etc/ld.so.conf.d/openssl-1.1.1i.conf #this is for shared libs.`

    #paste this into the window opened for openssl-1.1.1i.conf
    /usr/local/ssl/lib
    

`:wq #using it to quit file edit mode.`

`sudo ldconfig -v #to refresh dynamic link.`

### Have a check with our new openssl 1.1.0+ by bellow two commands!

`which openssl`

`openssl version`

> Yours should be similar(according to our official version may not exactly be the same) with mine like bellow.

![Hooray! The result of openssl is fine! ](https://storage.googleapis.com/papyrus_images/0f62369fe157612fc7672c7b3069c0f5e53dd315041a76b2fd387fa5da3f5aa1.png)

Hooray! The result of openssl is fine!

### Now, you can have a check with the command \[anchor test\] in your project again. 😊Surprise~

* * *

Plus
----

> I heard that there is a way to deal with the problem by using lsb packages.
> 
> However, unfortunately, I’m not sure whether it should be true, due to Red Hat Team doesn’t support redhat-lsb/redhat-lsb-core in CentOS 9 until now as [this link from bugzilla](https://bugzilla.redhat.com/show_bug.cgi?id=2012924#c4).
> 
> If you have interest in, you can have a check about [this one](https://bugzilla.redhat.com/show_bug.cgi?id=2088203#c3) I found, but just not working for me.

At the end
==========

> Please feel free to have a feedback with me on Twitter or [Discord](https://discordapp.com/users/498428518171148289)!

---

*Originally published on [Kevin](https://paragraph.com/@kevin-45/solana-anchor-problem-with-openssl-in-centos-9)*
