I love playing terraria and i want to play with my friend. I set up all the port forwarding and stuff just cant find the server software can i please have a link.
I haven't hosted in a while, but when I did, there was already a server executable in the terraria folder.
I believe the executable was in steam/steamsapps/common/terraria (top-level, no sub-folders).
This is only if you want the server running separately, so friends can join without you playing Terraria. If you're always going to be playing, going in the game and doing Multiplayer -> Host & Play is probably easier.
Go to terraria.org, scroll to the bottom and click "dedicated server software ([version])". Alternatively you can host a game from the game client itself by selecting "Host" from the multiplayer menu.
To launch the dedicated server, the easiest way to do it is to right-click on Terraria in Steam, select Properties, select the Local Files tab, then select the Browse Local Files... option. This will open up the directory where your Terraria files are located on your PC.
In this folder, you'll see the TerrariaServer executable, which you can now run.
Launching this will give you an option to pick the world to play on (or create a new one), the number of players permitted, and the port to host on, plus allowing to set up port forwarding automatically. After this is done it'll start the server, and the program will now allow you to issue commands via the console. To join the server yourself, join it like any other multiplayer server. If you don't know your IP, search for "What is my IP" on Google and it will tell you at the top of the search results.
To stop the server, type exit in the console.
To stop the server without saving, type exit-nosave in the console.
To exit the program immediately, type Ctrl+C