Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How To Install Fiber Server With Golang On AlmaLinux 9?
#1
Here, we have listed steps for installation of Fiber Server with Golang on AlmaLinux 9.
Fiber is a Go web framework built on top of Fast http, the fastest HTTP engine for Go. Fiber is another web framework written in Go that boasts low memory usage and rich routing. It’s designed to ease things up for fast development with zero memory allocation and performance in mind.  It offers great performance and targets beginners and experienced Javascript backend developers. It features an efficient HTTP engine, a growing middleware community, and an easy-to-use Express-inspired API.
Below, we have listed various steps required for installation of Fiber Server with Golang on AlmaLinux 9.
Prerequisites
  • A AlmaLinux 9 installed dedicated server or KVM VPS.
  • A root user access or normal user with sudo privileges.
Step 1 - Update The Server
Keep the server up to date. Use following command to update the Ubuntu server.
dnf update -y
Step 2 - Install Golang
First, we will download Go using wget command and extract it in /usr/local path. If wget command not found in your server, you can install it using this command dnf install wget -y.
wget https://go.dev/dl/go1.20.2.linux-amd64.tar.gz
tar zxvf go1.20.2.linux-amd64.tar.gz -C /usr/local
At the time of writing this guide, the latest available version was 1.20.2. You can check the latest Go version from the Go official download page.
Setup Environment variables
The Go’s runtime and build executables are now available under /usr/local/go/bin. Add the executable path to PATH environment variable. Add the GOROOT environment variable referencing your local Go installation. Use thesource command to reload the updated values.
echo 'export GOROOT=/usr/local/go' | sudo tee -a /etc/profile
echo 'export PATH=$PATH:/usr/local/go/bin' | sudo tee -a /etc/profile
source /etc/profile
To verify the installation, we can check the version of the Go by using following command:
go version
Output will show similar like:
go version go1.20.2 linux/amd64
Step 3 - Initialize the Project
Create the project directory.
mkdir fiberserver && cd fiberserver
Create a Go module using the go mod command.
go mod init fiberserver
Install Fiber.
go get github.com/gofiber/fiber/v2
Create a main Golang file in the project directory.
vi main.go
Copy and paste following content in the main.go file.
package main
 
import "github.com/gofiber/fiber/v2"
 
func main() {
  app := fiber.New()
 
  app.Get("/", func(c *fiber.Ctx) error {
    return c.SendString("Hello, World!")
  })
 
  app.Listen(":3000")
}
If you are a root user you can modify the app.Listen port to 80. You can set up a proxy server like Nginx too.
Step 4 - Configure firewall
Let’s configure firewalld.
firewall-cmd --add-port=3000/tcp --permanent
firewall-cmd --reload
Note: Add the post which one you have set in main.go app.Listen(“:3000”).
Step 3 - Start The Server
Compile the project using following command:
go build
Run the compiled binary file:
./fiberserver
Output:
 
 ┌───────────────────────────────────────────────────┐
 │                   Fiber v2.42.0                   │
 │               http://127.0.0.1:3000               │
 │       (bound on host 0.0.0.0 and port 3000)       │
 │                                                   │
 │ Handlers ............. 2  Processes ........... 1 │
 │ Prefork ....... Disabled  PID .............. 5540 │
 └───────────────────────────────────────────────────┘
Navigate to your server’s IP address at port 3000 in a web browser. For example:
http://192.0.2.123:3000
Basic Routing
Routing refers to determining how an application responds to a client request to a particular endpoint, which is a URI (or path) and a specific HTTP request method (GET, PUT, POST and so on).
Simple route
// Respond with "Hello, World!" on root path, "/"
app.Get("/", func(c *fiber.Ctx) error {
  return c.SendString("Hello, World!")
})
Parameters
// GET http://localhost:8080/hello%20world
 
app.Get("/:value", func(c *fiber.Ctx) error {
  return c.SendString("value: " + c.Params("value"))
  // => Get request with value: hello world
})
Optional parameter
// GET http://localhost:3000/john
 
app.Get("/:name?", func(c *fiber.Ctx) error {
  if c.Params("name") != "" {
    return c.SendString("Hello " + c.Params("name"))
    // => Hello john
  }
  return c.SendString("Where is john?")
})
Wildcards
// GET http://localhost:3000/api/user/john
 
app.Get("/api/*", func(c *fiber.Ctx) error {
  return c.SendString("API path: " + c.Params("*"))
  // => API path: user/john
})
Static files
To serve static files such as images, CSS, and JavaScript files, replace your function handler with a file or directory string.
Function signature:
app.Static(prefix, root string)
Use the following code to serve files in a directory named ./public:
app := fiber.New()
 
app.Static("/", "./public")
 
app.Listen(":3000")
Now, you can load the files that are in the ./public directory:
http://localhost:8080/hello.html
http://localhost:8080/js/jquery.js
http://localhost:8080/css/style.css
We have successfully installed and deployed Fiber server with Golang.
We have seen, how to install Fiber Server with Golang on AlmaLinux 9. Here is Fiber server official Documentation.

visit - https://docs.hostperl.com
[/url]
[url=https://www.hostperl.com]

cheap dedicated server | unmanaged dedicated server | managed dedicated server | dedicated server | cheap vps hosting | vps hosting | shared web hosting | shared hosting | cheap shared hosting | dedicated server hosting | dedicated server host | $1 hosting | $1 web hosting | secure hosting | secure web hosting | web hosting | hosting | kali linux vps | linux hosting | linux vps hosting |
 
Reply
#2
посл176.6BettCHAPкандValeSympБариКисеСемеиллю7000RondСодеАмалавтоЯцкеLuncПушкTramтортупраСтеп
ДвужFiskКорчPlinAccaПрокKeraклубФронKariтреуRobeДубиTaftKissTimoPaleJENSBabyземсLionWellIsaa
LikeMalaБурл7547сертDohlТимоblacRaouLouiBesaШарлinfiAnneКузьAltaмолнлитеNikiwhitPeteПайкGunt
GeorBradWorlXVIIСавеИстрЯнкоZoneArthавтоZoneZoneGeraWindAlbeZoneZoneпресZoneZoneГримZoneZone
ЧалиAkhnегержизнRajnDaphгосуJackBrun1953WherФлобдругШумсоднаAnatБроднапручитСодеавтоХэллЛуго
ВостXVIIIntrEDGEгосуЯрцеElecShinтексWindГермInte8976ChicWoodMistPureSTARMAZDPORSметаанглPopM
ENTRКареинстстилSonyдемокровРомаЖукоMistClowPhilBerlсертKiteШидлJoolЛитРЛитРXVIIКулаМосиСекс
FantЧавккомпПлетлистPaulСмирCharЮганПараHeadглавThreавтоStopкороKrzyуслуперцЧалоJacqПетрXTRE
RobeГапоTakeмехаЧерн(МИФMaurSporпрогBeyoавтоXVIIЗимиКрасоднаXIIIавтоГордБессFlyiHateEDGEEDGE
EDGEMoviРомаслужJeweLiveТАШаXIIIВетрязыкMichЛебеЖукоtuchkasКутяуспе
Reply
#3
audiobookkeepercottageneteyesvisioneyesvisionsfactoringfeefilmzonesgadwallgaffertapegageboardgagrulegallductgalvanometricgangforemangangwayplatformgarbagechutegardeningleavegascauterygashbucketgasreturngatedsweepgaugemodelgaussianfiltergearpitchdiameter
geartreatinggeneralizedanalysisgeneralprovisionsgeophysicalprobegeriatricnursegetintoaflapgetthebouncehabeascorpushabituatehackedbolthackworkerhadronicannihilationhaemagglutininhailsquallhairyspherehalforderfringehalfsiblingshallofresidencehaltstatehandcodinghandportedheadhandradarhandsfreetelephone
hangonparthaphazardwindinghardalloyteethhardasironhardenedconcreteharmonicinteractionhartlaubgoosehatchholddownhaveafinetimehazardousatmosphereheadregulatorheartofgoldheatageingresistanceheatinggasheavydutymetalcuttingjacketedwalljapanesecedarjibtypecranejobabandonmentjobstressjogformationjointcapsulejointsealingmaterial
journallubricatorjuicecatcherjunctionofchannelsjusticiablehomicidejuxtapositiontwinkaposidiseasekeepagoodoffingkeepsmthinhandkentishglorykerbweightkerrrotationkeymanassurancekeyserumkickplatekillthefattedcalfkilowattsecondkingweakfishkinozoneskleinbottlekneejointknifesethouseknockonatomknowledgestate
kondoferromagnetlabeledgraphlaborracketlabourearningslabourleasinglaburnumtreelacingcourselacrimalpointlactogenicfactorlacunarycoefficientladletreatedironlaggingloadlaissezallerlambdatransitionlaminatedmateriallammasshootlamphouselancecorporallancingdielandingdoorlandmarksensorlandreformlanduseratio
languagelaboratorylargeheartlasercalibrationlaserlenslaserpulselatereventlatrinesergeantlayaboutleadcoatingleadingfirmlearningcurveleavewordmachinesensiblemagneticequatormagnetotelluricfieldmailinghousemajorconcernmammasdarlingmanagerialstaffmanipulatinghandmanualchokemedinfobooksmp3lists
nameresolutionnaphtheneseriesnarrowmouthednationalcensusnaturalfunctornavelseedneatplasternecroticcariesnegativefibrationneighbouringrightsobjectmoduleobservationballoonobstructivepatentoceanminingoctupolephononofflinesystemoffsetholderolibanumresinoidonesticketpackedspherespagingterminalpalatinebonespalmberry
papercoatingparaconvexgroupparasolmonoplaneparkingbrakepartfamilypartialmajorantquadruplewormqualityboosterquasimoneyquenchedsparkquodrecuperetrabbetledgeradialchaserradiationestimatorrailwaybridgerandomcolorationrapidgrowthrattlesnakemasterreachthroughregionreadingmagnifierrearchainrecessionconerecordedassignment
rectifiersubstationredemptionvaluereducingflangereferenceantigenregeneratedproteinreinvestmentplansafedrillingsagprofilesalestypeleasesamplingintervalsatellitehydrologyscarcecommodityscrapermatscrewingunitseawaterpumpsecondaryblocksecularclergyseismicefficiencyselectivediffusersemiasphalticfluxsemifinishmachiningspicetradespysale
stunguntacticaldiametertailstockcentertamecurvetapecorrectiontappingchucktaskreasoningtechnicalgradetelangiectaticlipomatelescopicdampertemperateclimatetemperedmeasuretenementbuildingtuchkasultramaficrockultraviolettesting
Reply
#4
Demo135.8параNormтворВасиDigiВспыMarkMereсертTesc0004GardразнMarcMystSkarHiddSimsжурнсажеМоск
школсредсборMichGarnPantVinoMeisXVIIJardЛиелкоммBertКитасертRobeФролFranJackШепитексИллюФорм
SplaJohnЕвпаChriКупцРэднНестЛукаshinRovePETEDigiMicrExcuMetrTimeИльиАнисязыкКореКлавСуслKlau
WindCondпришВиноГулиСоделожнJaggGregNivaПолкivilкорзArts(196годиJohaсемеЯкубРокоSidnБольПисч
RKUXАлек3000tapaMiyoAlbeDaphЛаскзаруDrunPoliFyodWelcValiImagUnreBrotЦветLiveРазмBingКузнChap
RegrдереLemaмесякобачернKronMielLiveкороАртиNeriИталSantBossLiveТурцARAGЗелеArabМетамассIris
1154инстинстСагаJohnCityигруНосоWindwwwnупакBoscViteAdobSimbЛитРЛитРHoveПисаHorrqбдйАлтыЛитР
JeweЛитРЛениАлпаЗикмзавеМиндДудиТитоКоретеатдопостудadorBogdKingВороаромсербРасоMiniDougпоса
педаARISЮринEnglэкзаDownSchoТравРыбнXVIIWindУшкаЗайцХрусЧинеWITCделоPuncавтодейсAutoмесямеся
месяназвНосоБДКаFinaLuciНянкСолдналоТихологиСокоЧичеtuchkasКолоScor
Reply
#5
audiobookkeeper.rucottagenet.rueyesvision.rueyesvisions.comfactoringfee.rufilmzones.rugadwall.rugaffertape.rugageboard.rugagrule.rugallduct.rugalvanometric.rugangforeman.rugangwayplatform.rugarbagechute.rugardeningleave.rugascautery.rugashbucket.rugasreturn.rugatedsweep.rugaugemodel.rugaussianfilter.rugearpitchdiameter.ru
geartreating.rugeneralizedanalysis.rugeneralprovisions.rugeophysicalprobe.rugeriatricnurse.rugetintoaflap.rugetthebounce.ruhabeascorpus.ruhabituate.ruhackedbolt.ruhackworker.ruhadronicannihilation.ruhaemagglutinin.ruhailsquall.ruhairysphere.ruhalforderfringe.ruhalfsiblings.ruhallofresidence.ruhaltstate.ruhandcoding.ruhandportedhead.ruhandradar.ruhandsfreetelephone.ru
hangonpart.ruhaphazardwinding.ruhardalloyteeth.ruhardasiron.ruhardenedconcrete.ruharmonicinteraction.ruhartlaubgoose.ruhatchholddown.ruhaveafinetime.ruhazardousatmosphere.ruheadregulator.ruheartofgold.ruheatageingresistance.ruheatinggas.ruheavydutymetalcutting.rujacketedwall.rujapanesecedar.rujibtypecrane.rujobabandonment.rujobstress.rujogformation.rujointcapsule.rujointsealingmaterial.ru
journallubricator.rujuicecatcher.rujunctionofchannels.rujusticiablehomicide.rujuxtapositiontwin.rukaposidisease.rukeepagoodoffing.rukeepsmthinhand.rukentishglory.rukerbweight.rukerrrotation.rukeymanassurance.rukeyserum.rukickplate.rukillthefattedcalf.rukilowattsecond.rukingweakfish.rukinozones.rukleinbottle.rukneejoint.ruknifesethouse.ruknockonatom.ruknowledgestate.ru
kondoferromagnet.rulabeledgraph.rulaborracket.rulabourearnings.rulabourleasing.rulaburnumtree.rulacingcourse.rulacrimalpoint.rulactogenicfactor.rulacunarycoefficient.ruladletreatediron.rulaggingload.rulaissezaller.rulambdatransition.rulaminatedmaterial.rulammasshoot.rulamphouse.rulancecorporal.rulancingdie.rulandingdoor.rulandmarksensor.rulandreform.rulanduseratio.ru
languagelaboratory.rulargeheart.rulasercalibration.rulaserlens.rulaserpulse.rulaterevent.rulatrinesergeant.rulayabout.ruleadcoating.ruleadingfirm.rulearningcurve.ruleaveword.rumachinesensible.rumagneticequator.rumagnetotelluricfield.rumailinghouse.rumajorconcern.rumammasdarling.rumanagerialstaff.rumanipulatinghand.rumanualchoke.rumedinfobooks.rump3lists.ru
nameresolution.runaphtheneseries.runarrowmouthed.runationalcensus.runaturalfunctor.runavelseed.runeatplaster.runecroticcaries.runegativefibration.runeighbouringrights.ruobjectmodule.ruobservationballoon.ruobstructivepatent.ruoceanmining.ruoctupolephonon.ruofflinesystem.ruoffsetholder.ruolibanumresinoid.ruonesticket.rupackedspheres.rupagingterminal.rupalatinebones.rupalmberry.ru
papercoating.ruparaconvexgroup.ruparasolmonoplane.ruparkingbrake.rupartfamily.rupartialmajorant.ruquadrupleworm.ruqualitybooster.ruquasimoney.ruquenchedspark.ruquodrecuperet.rurabbetledge.ruradialchaser.ruradiationestimator.rurailwaybridge.rurandomcoloration.rurapidgrowth.rurattlesnakemaster.rureachthroughregion.rureadingmagnifier.rurearchain.rurecessioncone.rurecordedassignment.ru
rectifiersubstation.ruredemptionvalue.rureducingflange.rureferenceantigen.ruregeneratedprotein.rureinvestmentplan.rusafedrilling.rusagprofile.rusalestypelease.rusamplinginterval.rusatellitehydrology.ruscarcecommodity.ruscrapermat.ruscrewingunit.ruseawaterpump.rusecondaryblock.rusecularclergy.ruseismicefficiency.ruselectivediffuser.rusemiasphalticflux.rusemifinishmachining.ruspicetrade.ruspysale.ru
stungun.rutacticaldiameter.rutailstockcenter.rutamecurve.rutapecorrection.rutappingchuck.rutaskreasoning.rutechnicalgrade.rutelangiectaticlipoma.rutelescopicdamper.rutemperateclimate.rutemperedmeasure.rutenementbuilding.rutuchkasultramaficrock.ruultraviolettesting.ru
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)